Module: kamailio
Branch: master
Commit: 93c81f5326acc2aefaca01c347f79c972727d0bf
URL:
https://github.com/kamailio/kamailio/commit/93c81f5326acc2aefaca01c347f79c9…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: 2017-11-24T10:18:33+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/93c81f5326acc2aefaca01c347f79c9…
Patch:
https://github.com/kamailio/kamailio/commit/93c81f5326acc2aefaca01c347f79c9…
---
diff --git a/src/modules/nathelper/doc/nathelper_admin.xml
b/src/modules/nathelper/doc/nathelper_admin.xml
index 9c3373a9ec..c032fc3a84 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 a34d0a19dd..5e7b82b617 100644
--- a/src/modules/nathelper/nathelper.c
+++ b/src/modules/nathelper/nathelper.c
@@ -780,13 +780,13 @@ static int add_contact_alias_0(struct sip_msg *msg)
&& ((ip = str2ip6(&(uri.host))) == NULL)) {
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;
- }
+ 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)))
&&
+ (uri.proto == msg->rcv.proto)) {
+ LM_DBG("no need to add alias param\n");
+ return 2;
+ }
}
/* Check if function has been called already */