[Asterisk-cvs] asterisk/channels chan_sip.c,1.456,1.457

markster at lists.digium.com markster at lists.digium.com
Sat Jul 17 19:41:10 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory localhost.localdomain:/tmp/cvs-serv20932/channels

Modified Files:
	chan_sip.c 
Log Message:
Don't consider port number in name of peer in create_addr (bug #1974)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.456
retrieving revision 1.457
diff -u -d -r1.456 -r1.457
--- chan_sip.c	17 Jul 2004 22:06:26 -0000	1.456
+++ chan_sip.c	17 Jul 2004 23:27:11 -0000	1.457
@@ -1236,7 +1236,7 @@
 /*--- create_addr: create address structure from peer definition ---*/
 /*      Or, if peer not found, find it in the global DNS */
 /*      returns TRUE on failure, FALSE on success */
-static int create_addr(struct sip_pvt *r, char *peer)
+static int create_addr(struct sip_pvt *r, char *opeer)
 {
 	struct hostent *hp;
 	struct ast_hostent ahp;
@@ -1245,7 +1245,14 @@
 	char *port;
 	int portno;
 	char host[256], *hostn;
+	char peer[256]="";
 
+	strncpy(peer, opeer, sizeof(peer) - 1);
+	port = strchr(peer, ':');
+	if (port) {
+		*port = '\0';
+		port++;
+	}
 	r->sa.sin_family = AF_INET;
 	ast_mutex_lock(&peerl.lock);
 	p = find_peer(peer, NULL);
@@ -1314,10 +1321,6 @@
 	}
 	ast_mutex_unlock(&peerl.lock);
 	if (!p && !found) {
-		if ((port=strchr(peer, ':'))) {
-			*port='\0';
-			port++;
-		}
 		hostn = peer;
 		if (port)
 			portno = atoi(port);




More information about the svn-commits mailing list