[Asterisk-cvs] asterisk/channels chan_sip.c,1.619,1.620

markster at lists.digium.com markster at lists.digium.com
Sat Jan 8 19:11:18 CST 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv9170/channels

Modified Files:
	chan_sip.c 
Log Message:
Minor externip fixes (bug #3262)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.619
retrieving revision 1.620
diff -u -d -r1.619 -r1.620
--- chan_sip.c	7 Jan 2005 21:35:50 -0000	1.619
+++ chan_sip.c	9 Jan 2005 01:15:43 -0000	1.620
@@ -648,19 +648,19 @@
 	 */
 	struct sockaddr_in theirs;
 	theirs.sin_addr = *them;
-	if (externexpire && (time(NULL) >= externexpire)) {
-		struct ast_hostent ahp;
-		struct hostent *hp;
-		time(&externexpire);
-		externexpire += externrefresh;
-		if ((hp = ast_gethostbyname(externhost, &ahp))) {
-			memcpy(&externip.sin_addr, hp->h_addr, sizeof(externip));
-		} else
-			ast_log(LOG_NOTICE, "Warning: Re-lookup of '%s' failed!\n", externhost);
-	}
 	if (localaddr && externip.sin_addr.s_addr &&
 	   ast_apply_ha(localaddr, &theirs)) {
 		char iabuf[INET_ADDRSTRLEN];
+		if (externexpire && (time(NULL) >= externexpire)) {
+			struct ast_hostent ahp;
+			struct hostent *hp;
+			time(&externexpire);
+			externexpire += externrefresh;
+			if ((hp = ast_gethostbyname(externhost, &ahp))) {
+				memcpy(&externip.sin_addr, hp->h_addr, sizeof(externip.sin_addr));
+			} else
+				ast_log(LOG_NOTICE, "Warning: Re-lookup of '%s' failed!\n", externhost);
+		}
 		memcpy(us, &externip.sin_addr, sizeof(struct in_addr));
 		ast_inet_ntoa(iabuf, sizeof(iabuf), *(struct in_addr *)&them->s_addr);
 		ast_log(LOG_DEBUG, "Target address %s is not local, substituting externip\n", iabuf);




More information about the svn-commits mailing list