Module: sip-router Branch: master Commit: 998ae20b26360383386d5f677ec87301e6b3ba23 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=998ae20b...
Author: Juha Heinanen jh@tutpro.com Committer: Juha Heinanen jh@tutpro.com Date: Tue Mar 8 09:42:18 2011 +0200
* modules_k/nathelper: add_contact_alias() fix
- add_contact_alias() is now able to add alias also to contact URI, where hostpart contains a domain name instead of an IP address.
---
modules_k/nathelper/nathelper.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/modules_k/nathelper/nathelper.c b/modules_k/nathelper/nathelper.c index 52c5e5f..4f303cb 100644 --- a/modules_k/nathelper/nathelper.c +++ b/modules_k/nathelper/nathelper.c @@ -775,7 +775,7 @@ fix_nated_contact_f(struct sip_msg* msg, char* str1, char* str2) #define SALIAS_LEN (sizeof(SALIAS) - 1)
/* - * Adds ;alias=ip:port param to cotact uri containing received ip:port + * Adds ;alias=ip:port param to contact uri containing received ip:port * if contact uri ip:port does not match received ip:port. */ static int @@ -806,14 +806,14 @@ add_contact_alias_f(struct sip_msg* msg, char* str1, char* str2)
/* Compare source ip and port against contact uri */ if ((ip = str2ip(&(uri.host))) == NULL) { - LM_ERR("contact uri host is not an ip address\n"); - return -1; - } - 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; + 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; + } } /* Check if function has been called already */