[asterisk-commits] mjordan: branch 1.8 r421717 - /branches/1.8/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 21 12:32:20 CDT 2014


Author: mjordan
Date: Thu Aug 21 12:32:12 2014
New Revision: 421717

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=421717
Log:
chan_sip: Don't use port derived from fromdomain if it isn't set

If a user does not provide a port in the fromdomain setting, chan_sip will set
the fromdomainport to STANDARD_SIP_PORT (5060). The fromdomainport value will
then get used unilaterally in certain places. This causes issues with TLS,
where the default port is expected to be 5061.

This patch modifies chan_sip such that fromdomainport is only used if it is
not the standard SIP port; otherwise, the port from the SIP pvt's recorded
self IP address is used.

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

ASTERISK-24178 #close
Reported by: Elazar Broad
patches:
  fromdomainport_fix.diff uploaded by Elazar Broad (License 5835)

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=421717&r1=421716&r2=421717
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Thu Aug 21 12:32:12 2014
@@ -12430,7 +12430,7 @@
 		ast_uri_encode(l, tmp_l, sizeof(tmp_l), 0);
 	}
 
-	ourport = (p->fromdomainport) ? p->fromdomainport : ast_sockaddr_port(&p->ourip);
+	ourport = (p->fromdomainport && (p->fromdomainport != STANDARD_SIP_PORT)) ? p->fromdomainport : ast_sockaddr_port(&p->ourip);
 	if (!sip_standard_port(p->socket.type, ourport)) {
 		snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s:%d>;tag=%s", n, tmp_l, d, ourport, p->tag);
 	} else {
@@ -13327,7 +13327,7 @@
 {
 	struct sip_request req;
 	struct ast_str *out = ast_str_alloca(500);
-	int ourport = (p->fromdomainport) ? p->fromdomainport : ast_sockaddr_port(&p->ourip);
+	int ourport = (p->fromdomainport && (p->fromdomainport != STANDARD_SIP_PORT)) ? p->fromdomainport : ast_sockaddr_port(&p->ourip);
 	const char *domain;
 	const char *exten = S_OR(vmexten, default_vmexten);
 




More information about the asterisk-commits mailing list