Module: kamailio Branch: 5.0 Commit: ae575733a2761dba1232166f105eeb82781229e6 URL: https://github.com/kamailio/kamailio/commit/ae575733a2761dba1232166f105eeb82...
Author: Juha Heinanen jh@tutpro.com Committer: Juha Heinanen jh@tutpro.com Date: 2017-11-24T10:58:57+02:00
modules/nathelper: check also transport protocol when determining if ;alias parameter needs to be added by add_contact_alias() call
---
Modified: src/modules/nathelper/doc/nathelper_admin.xml Modified: src/modules/nathelper/nathelper.c
---
Diff: https://github.com/kamailio/kamailio/commit/ae575733a2761dba1232166f105eeb82... Patch: https://github.com/kamailio/kamailio/commit/ae575733a2761dba1232166f105eeb82...
---
diff --git a/src/modules/nathelper/doc/nathelper_admin.xml b/src/modules/nathelper/doc/nathelper_admin.xml index d08f80c3a5..d7ea668e02 100644 --- a/src/modules/nathelper/doc/nathelper_admin.xml +++ b/src/modules/nathelper/doc/nathelper_admin.xml @@ -707,8 +707,8 @@ if(is_rfc1918("$rd")) { the contact URI containing either received ip, port, and transport protocol or those given as parameters. If called without parameters, <quote>;alias</quote> parameter is - only added if received ip and port differ from those in - contact URI. + only added if received ip, port, or transport protocol differs + from that in contact URI. </para> <para> This function can be used from diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c index 283e75c89b..642318d52b 100644 --- a/src/modules/nathelper/nathelper.c +++ b/src/modules/nathelper/nathelper.c @@ -799,11 +799,12 @@ add_contact_alias_0(struct sip_msg* msg) LM_DBG("contact uri host is not an ip address\n"); } else { if (ip_addr_cmp(ip, &(msg->rcv.src_ip)) && - ((msg->rcv.src_port == uri.port_no) || - ((uri.port.len == 0) && (msg->rcv.src_port == 5060)))) { - LM_DBG("no need to add alias param\n"); - return 2; - } + ((msg->rcv.src_port == uri.port_no) || + ((uri.port.len == 0) && (msg->rcv.src_port == 5060))) && + (uri.proto == msg->rcv.proto)) { + LM_DBG("no need to add alias param\n"); + return 2; + } }
/* Check if function has been called already */