Module: kamailio Branch: master Commit: 99cc12f3fb0f114d406a2af0dcc1b48a41484134 URL: https://github.com/kamailio/kamailio/commit/99cc12f3fb0f114d406a2af0dcc1b48a...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2016-02-03T22:48:25+01:00
sipcapture: new parameter topoh_unmask
- if set to 1, call-id will be unmasked using topoh module api
---
Modified: modules/sipcapture/sipcapture.c
---
Diff: https://github.com/kamailio/kamailio/commit/99cc12f3fb0f114d406a2af0dcc1b48a... Patch: https://github.com/kamailio/kamailio/commit/99cc12f3fb0f114d406a2af0dcc1b48a...
---
diff --git a/modules/sipcapture/sipcapture.c b/modules/sipcapture/sipcapture.c index dc51c50..41d153e 100644 --- a/modules/sipcapture/sipcapture.c +++ b/modules/sipcapture/sipcapture.c @@ -83,6 +83,8 @@ #endif
+#include "../topoh/api.h" + MODULE_VERSION
@@ -226,6 +228,9 @@ int n_callid_aleg_headers = 0;
struct ifreq ifr; /* interface structure */
+static int sc_topoh_unmask = 0; +static topoh_api_t thb = {0}; + #ifdef __OS_linux /* Linux socket filter */ /* tcpdump -s 0 udp and portrange 5060-5090 -dd */ @@ -336,6 +341,7 @@ static param_export_t params[] = { {"insert_retries", INT_PARAM, &insert_retries }, {"insert_retry_timeout", INT_PARAM, &insert_retry_timeout }, {"table_time_sufix", PARAM_STR, &table_time_sufix }, + {"topoh_unamsk", PARAM_INT, &sc_topoh_unmask }, {0, 0, 0} };
@@ -695,9 +701,8 @@ int capture_mode_param(modparam_t type, void *val){
/*! \brief Initialize sipcapture module */ -static int mod_init(void) { - - +static int mod_init(void) +{ struct ip_addr *ip = NULL; char * def_params = NULL;
@@ -720,6 +725,14 @@ static int mod_init(void) { return -1; }
+ if(sc_topoh_unmask==1) { + /* bind the topoh API */ + if (topoh_load_api(&thb)!=0) { + LM_ERR("cannot bind to topoh API\n"); + return -1; + } + } + /*Check the table name - if table_name is empty and no capture modes are defined, then error*/ if(!table_name.len && capture_modes_root == NULL) { LM_ERR("ERROR: sipcapture: mod_init: table_name is not defined or empty\n"); @@ -1212,6 +1225,7 @@ static int sip_capture_store(struct _sipcapture_object *sco, str *dtable, _captu db_insert_f insert; time_t retry_failed_time = 0; struct tm capt_ts; + str ocallid;
/* new */ str *table = NULL; @@ -1231,6 +1245,12 @@ static int sip_capture_store(struct _sipcapture_object *sco, str *dtable, _captu return -1; }
+ if(sc_topoh_unmask==1) { + if(thb.unmask_callid(&sco->callid, &ocallid)==0) { + sco->callid = ocallid; + } + } + if(correlation_id) { corrtmp.s = correlation_id; corrtmp.len = strlen(correlation_id);