[svn-commits] oej: branch 1.2 r58847 - /branches/1.2/channels/chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Mar 13 04:45:53 MST 2007


Author: oej
Date: Tue Mar 13 06:45:52 2007
New Revision: 58847

URL: http://svn.digium.com/view/asterisk?view=rev&rev=58847
Log:
Issue #9229 - No port in request URI on register to non default SIP ports (neelakantan)

Modified:
    branches/1.2/channels/chan_sip.c

Modified: branches/1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_sip.c?view=diff&rev=58847&r1=58846&r2=58847
==============================================================================
--- branches/1.2/channels/chan_sip.c (original)
+++ branches/1.2/channels/chan_sip.c Tue Mar 13 06:45:52 2007
@@ -5643,10 +5643,17 @@
 	
 	/* Fromdomain is what we are registering to, regardless of actual
 	   host name from SRV */
-	if (!ast_strlen_zero(p->fromdomain))
-		snprintf(addr, sizeof(addr), "sip:%s", p->fromdomain);
-	else
-		snprintf(addr, sizeof(addr), "sip:%s", r->hostname);
+	if (!ast_strlen_zero(p->fromdomain)) {
+		if (r->portno && r->portno != DEFAULT_SIP_PORT)
+			snprintf(addr, sizeof(addr), "sip:%s:%d", p->fromdomain, r->portno);
+		else
+			snprintf(addr, sizeof(addr), "sip:%s", p->fromdomain);
+	} else {
+		if (r->portno && r->portno != DEFAULT_SIP_PORT)
+			snprintf(addr, sizeof(addr), "sip:%s:%d", r->hostname, r->portno);
+		else
+			snprintf(addr, sizeof(addr), "sip:%s", r->hostname);
+	}
 	ast_copy_string(p->uri, addr, sizeof(p->uri));
 
 	p->branch ^= thread_safe_rand();



More information about the svn-commits mailing list