[asterisk-commits] jpeeler: branch 1.6.2 r276809 - in /branches/1.6.2: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 15 15:42:47 CDT 2010


Author: jpeeler
Date: Thu Jul 15 15:42:43 2010
New Revision: 276809

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=276809
Log:
Merged revisions 276788 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r276788 | jpeeler | 2010-07-15 15:21:03 -0500 (Thu, 15 Jul 2010) | 6 lines
  
  Correct not setting the bindport before attempting to open the socket.
  
  Related to changes from 276571, I was accidentally testing with a port set in
  my configuration causing me to miss this. Also moved the TCP handling as well
  to occur before build_peer is called.
........

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

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

Modified: branches/1.6.2/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/channels/chan_sip.c?view=diff&rev=276809&r1=276808&r2=276809
==============================================================================
--- branches/1.6.2/channels/chan_sip.c (original)
+++ branches/1.6.2/channels/chan_sip.c Thu Jul 15 15:42:43 2010
@@ -25085,6 +25085,15 @@
  			authl = add_realm_authentication(authl, v->value, v->lineno);
  	}
 
+	/* Set UDP address and open socket */
+	bindaddr.sin_family = AF_INET;
+	internip = bindaddr;
+	if (ast_find_ourip(&internip.sin_addr, bindaddr)) {
+		ast_log(LOG_WARNING, "Unable to get own IP address, SIP disabled\n");
+		ast_config_destroy(cfg);
+		return 0;
+	}
+
 	ast_mutex_lock(&netlock);
 	if ((sipsock > -1) && (memcmp(&old_bindaddr, &bindaddr, sizeof(struct sockaddr_in)))) {
 		close(sipsock);
@@ -25128,6 +25137,30 @@
 			ast_inet_ntoa(externip.sin_addr) , ntohs(externip.sin_port));
 	}
 	ast_mutex_unlock(&netlock);
+
+	/* Start TCP server */
+	ast_tcptls_server_start(&sip_tcp_desc);
+ 	if (sip_tcp_desc.accept_fd == -1 &&  sip_tcp_desc.local_address.sin_family == AF_INET) {
+		/* TCP server start failed. Tell the admin */
+		ast_log(LOG_ERROR, "SIP TCP Server start failed. Not listening on TCP socket.\n");
+		sip_tcp_desc.local_address.sin_family = 0;
+	} else {
+		ast_debug(2, "SIP TCP server started\n");
+	}
+
+	/* Start TLS server if needed */
+	memcpy(sip_tls_desc.tls_cfg, &default_tls_cfg, sizeof(default_tls_cfg));
+
+	if (ast_ssl_setup(sip_tls_desc.tls_cfg)) {
+		ast_tcptls_server_start(&sip_tls_desc);
+ 		if (default_tls_cfg.enabled && sip_tls_desc.accept_fd == -1) {
+			ast_log(LOG_ERROR, "TLS Server start failed. Not listening on TLS socket.\n");
+			sip_tls_desc.tls_cfg = NULL;
+		}
+	} else if (sip_tls_desc.tls_cfg->enabled) {
+		sip_tls_desc.tls_cfg = NULL;
+		ast_log(LOG_WARNING, "SIP TLS server did not load because of errors.\n");
+	}
 
 	if (ucfg) {
 		struct ast_variable *gen;
@@ -25192,7 +25225,6 @@
 		}
 		ast_config_destroy(ucfg);
 	}
-	
 
 	/* Load peers, users and friends */
 	cat = NULL;
@@ -25226,40 +25258,6 @@
 			}
 		}
 	}
-	
-	/* Set UDP address and open socket */
-	bindaddr.sin_family = AF_INET;
-	internip = bindaddr;
-	if (ast_find_ourip(&internip.sin_addr, bindaddr)) {
-		ast_log(LOG_WARNING, "Unable to get own IP address, SIP disabled\n");
-		ast_config_destroy(cfg);
-		return 0;
-	}
-
-	/* Start TCP server */
-	ast_tcptls_server_start(&sip_tcp_desc);
- 	if (sip_tcp_desc.accept_fd == -1 &&  sip_tcp_desc.local_address.sin_family == AF_INET) {
-		/* TCP server start failed. Tell the admin */
-		ast_log(LOG_ERROR, "SIP TCP Server start failed. Not listening on TCP socket.\n");
-		sip_tcp_desc.local_address.sin_family = 0;
-	} else {
-		ast_debug(2, "SIP TCP server started\n");
-	}
-
-	/* Start TLS server if needed */
-	memcpy(sip_tls_desc.tls_cfg, &default_tls_cfg, sizeof(default_tls_cfg));
-
-	if (ast_ssl_setup(sip_tls_desc.tls_cfg)) {
-		ast_tcptls_server_start(&sip_tls_desc);
- 		if (default_tls_cfg.enabled && sip_tls_desc.accept_fd == -1) {
-			ast_log(LOG_ERROR, "TLS Server start failed. Not listening on TLS socket.\n");
-			sip_tls_desc.tls_cfg = NULL;
-		}
-	} else if (sip_tls_desc.tls_cfg->enabled) {
-		sip_tls_desc.tls_cfg = NULL;
-		ast_log(LOG_WARNING, "SIP TLS server did not load because of errors.\n");
-	}
-
 
 	/* Add default domains - host name, IP address and IP:port
 	 * Only do this if user added any sip domain with "localdomains" 




More information about the asterisk-commits mailing list