Module: kamailio
Branch: master
Commit: a5f8810223021939b12eb0d04fc625f8d36980f7
URL: 
https://github.com/kamailio/kamailio/commit/a5f8810223021939b12eb0d04fc625f8d36980f7

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2021-04-09T16:37:30+02:00

siptrace: fallback to udp if send sock is not set

---

Modified: src/modules/siptrace/siptrace.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/a5f8810223021939b12eb0d04fc625f8d36980f7.diff
Patch: 
https://github.com/kamailio/kamailio/commit/a5f8810223021939b12eb0d04fc625f8d36980f7.patch

---

diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 31cabefe3b..4648340d73 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) {


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to