diff --git a/modules/topoh/th_msg.c b/modules/topoh/th_msg.c index 1d4287f44ae..5519b8daac0 100644 --- a/modules/topoh/th_msg.c +++ b/modules/topoh/th_msg.c @@ -57,6 +57,7 @@ extern str th_vparam_prefix; extern int th_param_mask_callid; extern int th_mask_addr_myself; +extern int th_uri_prefix_checks; int th_skip_rw(char *s, int len) { @@ -391,8 +392,8 @@ int th_unmask_via(sip_msg_t *msg, str *cookie) if(i!=1) { /* Skip if via is not encoded */ - if (via->host.len!=th_ip.len - || strncasecmp(via->host.s, th_ip.s, th_ip.len)!=0) + if (th_uri_prefix_checks && (via->host.len!=th_ip.len + || strncasecmp(via->host.s, th_ip.s, th_ip.len)!=0)) { LM_DBG("via %d is not encoded",i); continue; @@ -687,10 +688,13 @@ int th_unmask_route(sip_msg_t *msg) if(i!=1) { /* Skip if route is not encoded */ - if ((rr->nameaddr.uri.lennameaddr.uri.s,th_uri_prefix.s,th_uri_prefix.len)!=0)) + if (th_uri_prefix_checks + && ((rr->nameaddr.uri.lennameaddr.uri.s,th_uri_prefix.s, + th_uri_prefix.len)!=0))) { - LM_DBG("rr %d is not encoded: [%.*s]",i,rr->nameaddr.uri.len,rr->nameaddr.uri.s); + LM_DBG("rr %d is not encoded: [%.*s]", i, + rr->nameaddr.uri.len, rr->nameaddr.uri.s); rr = rr->next; continue; } @@ -736,8 +740,9 @@ int th_unmask_ruri(sip_msg_t *msg) str out; /* Do nothing if ruri is not encoded */ - if ((REQ_LINE(msg).uri.lenuri); /* Do nothing if refer_to is not encoded */ - if ((uri->lens, th_uri_prefix.s, th_uri_prefix.len)!=0)) + if (th_uri_prefix_checks && ((uri->lens, th_uri_prefix.s, th_uri_prefix.len)!=0))) { LM_DBG("refer-to [%.*s] is not encoded",uri->len,uri->s); return 0; diff --git a/modules/topoh/topoh_mod.c b/modules/topoh/topoh_mod.c index 266cc465a8e..9742cef143b 100644 --- a/modules/topoh/topoh_mod.c +++ b/modules/topoh/topoh_mod.c @@ -74,11 +74,12 @@ str th_uri_prefix = {0, 0}; int th_param_mask_callid = 0; int th_sanity_checks = 0; -sanity_api_t scb; +int th_uri_prefix_checks = 0; int th_mask_addr_myself = 0; int th_msg_received(void *data); int th_msg_sent(void *data); +sanity_api_t scb; /** module functions */ static int mod_init(void); @@ -93,6 +94,7 @@ static param_export_t params[]={ {"vparam_prefix", PARAM_STR, &th_vparam_prefix}, {"callid_prefix", PARAM_STR, &th_callid_prefix}, {"sanity_checks", PARAM_INT, &th_sanity_checks}, + {"uri_prefix_checks", PARAM_INT, &th_uri_prefix_checks}, {0,0,0} };