Module: kamailio
Branch: master
Commit: 9d8432f3ffb1f9d07874452e23140be21e75c530
URL:
https://github.com/kamailio/kamailio/commit/9d8432f3ffb1f9d07874452e23140be…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-10-11T10:57:05+02:00
siptrace: added parameter data_mode
- control if bind address of advertised address are used
---
Modified: src/modules/siptrace/siptrace.c
---
Diff:
https://github.com/kamailio/kamailio/commit/9d8432f3ffb1f9d07874452e23140be…
Patch:
https://github.com/kamailio/kamailio/commit/9d8432f3ffb1f9d07874452e23140be…
---
diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 31609821682..257cf0eb335 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -133,6 +133,9 @@ int siptrace_net_data_sent(sr_event_param_t *evp);
static int _siptrace_init_mode = 0;
static int _siptrace_mode = 0;
+#define SIPTRACE_DATA_MODE_ADVADDR 1 /* use advertised address */
+static int _siptrace_data_mode = 0;
+
static str db_url = str_init(DEFAULT_DB_URL);
static str siptrace_table = str_init("sip_trace");
@@ -272,6 +275,7 @@ static param_export_t params[] = {
{"trace_db_mode", INT_PARAM, &trace_db_mode},
{"trace_init_mode", PARAM_INT, &_siptrace_init_mode},
{"trace_mode", PARAM_INT, &_siptrace_mode},
+ {"data_mode", PARAM_INT, &_siptrace_data_mode},
{"evcb_msg", PARAM_STR, &_siptrace_evcb_msg},
{"trace_dialog_ack", PARAM_INT, &trace_dialog_ack},
{"trace_dialog_spiral", PARAM_INT, &trace_dialog_spiral},
@@ -2308,7 +2312,8 @@ int siptrace_net_data_recv(sr_event_param_t *evp)
sto.fromip.s = sto.fromip_buff;
}
- if(nd->rcv->bind_address != NULL
+ if((_siptrace_data_mode & SIPTRACE_DATA_MODE_ADVADDR)
+ && nd->rcv->bind_address != NULL
&& nd->rcv->bind_address->useinfo.sock_str.len > 0
&& (nd->rcv->bind_address->useinfo.sock_str.len
< SIPTRACE_ADDR_MAX - 1)) {
@@ -2449,7 +2454,8 @@ int siptrace_net_data_sent(sr_event_param_t *evp)
sto.fromip.len = SIPTRACE_ANYADDR_LEN;
proto = PROTO_UDP;
} else {
- if(new_dst.send_sock->useinfo.sock_str.len > 0) {
+ if((_siptrace_data_mode & SIPTRACE_DATA_MODE_ADVADDR)
+ && new_dst.send_sock->useinfo.sock_str.len > 0) {
vsock = new_dst.send_sock->useinfo.sock_str;
} else {
vsock = new_dst.send_sock->sock_str;