[asterisk-commits] oej: trunk r46649 - /trunk/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Oct 31 06:51:31 MST 2006


Author: oej
Date: Tue Oct 31 07:51:30 2006
New Revision: 46649

URL: http://svn.digium.com/view/asterisk?rev=46649&view=rev
Log:
Cleaning up code

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=46649&r1=46648&r2=46649&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Oct 31 07:51:30 2006
@@ -2740,33 +2740,33 @@
 {
 	struct hostent *hp;
 	struct ast_hostent ahp;
-	struct sip_peer *p;
+	struct sip_peer *peer;
 	char *port;
 	int portno;
 	char host[MAXHOSTNAMELEN], *hostn;
-	char peer[256];
-
-	ast_copy_string(peer, opeer, sizeof(peer));
-	port = strchr(peer, ':');
+	char peername[256];
+
+	ast_copy_string(peername, opeer, sizeof(peername));
+	port = strchr(peername, ':');
 	if (port)
 		*port++ = '\0';
 	dialog->sa.sin_family = AF_INET;
 	dialog->timer_t1 = 500; /* Default SIP retransmission timer T1 (RFC 3261) */
-	p = find_peer(peer, NULL, 1);
-
-	if (p) {
-		int res = create_addr_from_peer(dialog, p);
-		ASTOBJ_UNREF(p, sip_destroy_peer);
+	peer = find_peer(peername, NULL, 1);
+
+	if (peer) {
+		int res = create_addr_from_peer(dialog, peer);
+		ASTOBJ_UNREF(peer, sip_destroy_peer);
 		return res;
 	}
-	hostn = peer;
+	hostn = peername;
 	portno = port ? atoi(port) : STANDARD_SIP_PORT;
 	if (srvlookup) {
 		char service[MAXHOSTNAMELEN];
 		int tportno;
 		int ret;
 
-		snprintf(service, sizeof(service), "_sip._udp.%s", peer);
+		snprintf(service, sizeof(service), "_sip._udp.%s", peername);
 		ret = ast_get_srv(NULL, host, sizeof(host), &tportno, service);
 		if (ret > 0) {
 			hostn = host;
@@ -2775,10 +2775,10 @@
 	}
 	hp = ast_gethostbyname(hostn, &ahp);
 	if (!hp) {
-		ast_log(LOG_WARNING, "No such host: %s\n", peer);
+		ast_log(LOG_WARNING, "No such host: %s\n", peername);
 		return -1;
 	}
-	ast_string_field_set(dialog, tohost, peer);
+	ast_string_field_set(dialog, tohost, peername);
 	memcpy(&dialog->sa.sin_addr, hp->h_addr, sizeof(dialog->sa.sin_addr));
 	dialog->sa.sin_port = htons(portno);
 	dialog->recv = dialog->sa;



More information about the asterisk-commits mailing list