From a5f8810223021939b12eb0d04fc625f8d36980f7 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Fri, 9 Apr 2021 16:37:30 +0200 Subject: [PATCH] siptrace: fallback to udp if send sock is not set --- src/modules/siptrace/siptrace.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c index 31cabefe3b5..4648340d733 100644 --- a/src/modules/siptrace/siptrace.c +++ b/src/modules/siptrace/siptrace.c @@ -2211,6 +2211,7 @@ int siptrace_net_data_sent(sr_event_param_t *evp) dest_info_t new_dst; siptrace_data_t sto; sip_msg_t tmsg; + int proto; if(evp->data == 0) return -1; @@ -2238,6 +2239,7 @@ int siptrace_net_data_sent(sr_event_param_t *evp) LM_WARN("no sending socket found\n"); strcpy(sto.fromip_buff, SIPTRACE_ANYADDR); sto.fromip.len = SIPTRACE_ANYADDR_LEN; + proto = PROTO_UDP; } else { if(new_dst.send_sock->sock_str.len>=SIPTRACE_ADDR_MAX-1) { LM_ERR("socket string is too large: %d\n", @@ -2247,11 +2249,12 @@ int siptrace_net_data_sent(sr_event_param_t *evp) strncpy(sto.fromip_buff, new_dst.send_sock->sock_str.s, new_dst.send_sock->sock_str.len); sto.fromip.len = new_dst.send_sock->sock_str.len; + proto = new_dst.send_sock->proto; } sto.fromip.s = sto.fromip_buff; sto.toip.len = snprintf(sto.toip_buff, SIPTRACE_ADDR_MAX, "%s:%s:%d", - siptrace_proto_name(new_dst.send_sock->proto), + siptrace_proto_name(proto), suip2a(&new_dst.to, sizeof(new_dst.to)), (int)su_getport(&new_dst.to)); if(sto.toip.len<0 || sto.toip.len>=SIPTRACE_ADDR_MAX) {