[asterisk-commits] elguero: branch 1.8 r376834 - /branches/1.8/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 29 15:49:48 CST 2012


Author: elguero
Date: Thu Nov 29 15:49:40 2012
New Revision: 376834

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376834
Log:
Improve Code Ceadability And Fix Setting natdetected Flag

For 1.8, 10, 11 and trunk we are are improving the code readability.

For 11 and trunk, auto nat detection was added.  The natdetected flag was being
set to 1 when the host address in the VIA header did not specifiy a port.  This
patch fixes this by setting the port on the temporary sock address used to
SIP_STANDARD_PORT in order for the sock address comparison to work properly.

(closes issue ASTERISK-20724)
Reported by: Michael L. Young
Patches:
    asterisk-20724-set-port-v2.diff uploaded by Michael L. Young (license 5026)

Review: https://reviewboard.asterisk.org/r/2206/

Modified:
    branches/1.8/channels/chan_sip.c

Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=376834&r1=376833&r2=376834
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Thu Nov 29 15:49:40 2012
@@ -16376,10 +16376,12 @@
 
 		if (ast_sockaddr_resolve_first(&tmp, c, 0)) {
 			ast_log(LOG_WARNING, "Could not resolve socket address for '%s'\n", c);
-		}
-		port = ast_sockaddr_port(&tmp);
-		ast_sockaddr_set_port(&p->sa,
-				      port != 0 ? port : STANDARD_SIP_PORT);
+			port = STANDARD_SIP_PORT;
+		} else if (!(port = ast_sockaddr_port(&tmp)) {
+			port = STANDARD_SIP_PORT;
+		}
+
+		ast_sockaddr_set_port(&p->sa, port);
 
 		if (sip_debug_test_pvt(p)) {
 			ast_verbose("Sending to %s (%s)\n",




More information about the asterisk-commits mailing list