[asterisk-commits] file: branch 1.6.0 r188248 - in /branches/1.6.0: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 14 08:16:09 CDT 2009


Author: file
Date: Tue Apr 14 08:16:05 2009
New Revision: 188248

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=188248
Log:
Merged revisions 188247 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r188247 | file | 2009-04-14 10:14:21 -0300 (Tue, 14 Apr 2009) | 7 lines
  
  Fix a bug with the change I made yesterday to outbound proxy support.
  
  Per discussion with oej on IRC we need the actual IP address, not the
  outbound proxy IP address, in the sa field. Upon further inspection
  this should make the behaviour of all other uses of the outbound proxy
  in the code.
........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/channels/chan_sip.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=188248&r1=188247&r2=188248
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Tue Apr 14 08:16:05 2009
@@ -4200,47 +4200,39 @@
 	/* Get the outbound proxy information */
 	dialog->outboundproxy = obproxy_get(dialog, NULL);
 
-	/* If we have an outbound proxy, don't bother with DNS resolution at all */
-	if (dialog->outboundproxy) {
-		/* If we have an outbound proxy, don't bother with DNS resolution at all, but set the port */
+	/* Let's see if we can find the host in DNS. First try DNS SRV records,
+	   then hostname lookup */
+	/*! \todo Fix this function. When we ask SRC, we should check all transports 
+	  In the future, we should first check NAPTR to find out transport preference
+	*/
+
+	hostn = peername;
+	/* Section 4.2 of RFC 3263 specifies that if a port number is specified, then
+	 * an A record lookup should be used instead of SRV.
+	 */
+	if (!port && global_srvlookup) {
+		char service[MAXHOSTNAMELEN];
+		int tportno;
+		int ret;
+
+		snprintf(service, sizeof(service), "_sip._%s.%s", get_transport(dialog->socket.type), peername);
+		ret = ast_get_srv(NULL, host, sizeof(host), &tportno, service);
+		if (ret > 0) {
+			hostn = host;
+			portno = tportno;
+		}
+	}
+	if (!portno)
 		portno = port ? atoi(port) : (dialog->socket.type & SIP_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT;
-		memcpy(&dialog->sa.sin_addr, &dialog->outboundproxy->ip.sin_addr, sizeof(dialog->sa.sin_addr));
-	} else {
-
-		/* Let's see if we can find the host in DNS. First try DNS SRV records,
-		   then hostname lookup */
-		/*! \todo Fix this function. When we ask SRC, we should check all transports 
-			  In the future, we should first check NAPTR to find out transport preference
-		 */
-
-		hostn = peername;
- 		/* Section 4.2 of RFC 3263 specifies that if a port number is specified, then
-		 * an A record lookup should be used instead of SRV.
-		 */
-		if (!port && global_srvlookup) {
-			char service[MAXHOSTNAMELEN];
-			int tportno;
-			int ret;
-
-			snprintf(service, sizeof(service), "_sip._%s.%s", get_transport(dialog->socket.type), peername);
-			ret = ast_get_srv(NULL, host, sizeof(host), &tportno, service);
-			if (ret > 0) {
-				hostn = host;
-				portno = tportno;
-			}
-		}
-	 	if (!portno)
-			portno = port ? atoi(port) : (dialog->socket.type & SIP_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT;
-		hp = ast_gethostbyname(hostn, &ahp);
-		if (!hp) {
-			ast_log(LOG_WARNING, "No such host: %s\n", peername);
-			return -1;
-		}
-		memcpy(&dialog->sa.sin_addr, hp->h_addr, sizeof(dialog->sa.sin_addr));
-		if (ast_strlen_zero(port) || sscanf(port, "%u", &portno) != 1) {
-			portno = (dialog->socket.type & SIP_TRANSPORT_TLS) ? 
-				STANDARD_TLS_PORT : STANDARD_SIP_PORT;
-		}
+	hp = ast_gethostbyname(hostn, &ahp);
+	if (!hp) {
+		ast_log(LOG_WARNING, "No such host: %s\n", peername);
+		return -1;
+	}
+	memcpy(&dialog->sa.sin_addr, hp->h_addr, sizeof(dialog->sa.sin_addr));
+	if (ast_strlen_zero(port) || sscanf(port, "%u", &portno) != 1) {
+		portno = (dialog->socket.type & SIP_TRANSPORT_TLS) ? 
+			STANDARD_TLS_PORT : STANDARD_SIP_PORT;
 	}
 
 	if (!dialog->socket.type)




More information about the asterisk-commits mailing list