[asterisk-commits] rizzo: trunk r76770 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 24 09:49:49 CDT 2007


Author: rizzo
Date: Tue Jul 24 09:49:49 2007
New Revision: 76770

URL: http://svn.digium.com/view/asterisk?view=rev&rev=76770
Log:
two small fixes when using stun (reported by Marta Carbone):
+ externexpire was not initialized properly;
+ stunaddr was not handled properly on a sip reload


Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=76770&r1=76769&r2=76770
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Jul 24 09:49:49 2007
@@ -17623,6 +17623,7 @@
 			stunaddr.sin_port = htons(3478);
 			if (ast_parse_arg(v->value, PARSE_INADDR, &stunaddr))
 				ast_log(LOG_WARNING, "Invalid STUN server address: %s\n", v->value);
+			externexpire = time(NULL);
 		} else if (!strcasecmp(v->name, "bindaddr")) {
 			if (ast_parse_arg(v->value, PARSE_INADDR, &bindaddr))
 				ast_log(LOG_WARNING, "Invalid address: %s\n", v->value);
@@ -17868,17 +17869,17 @@
 				if (option_verbose > 1)
 					ast_verbose(VERBOSE_PREFIX_2 "SIP Listening on %s:%d\n", 
 						ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
-				if (stunaddr.sin_addr.s_addr != 0) {
-					ast_debug(1, "stun to %s:%d\n",
-						ast_inet_ntoa(stunaddr.sin_addr) , ntohs(stunaddr.sin_port));
-					ast_stun_request(sipsock, &stunaddr,
-						NULL, &externip);
-					ast_debug(1, "STUN sees us at %s:%d\n", 
-						ast_inet_ntoa(externip.sin_addr) , ntohs(externip.sin_port));
-				}
 				ast_netsock_set_qos(sipsock, global_tos_sip, global_cos_sip);
 			}
 		}
+	}
+	if (stunaddr.sin_addr.s_addr != 0) {
+		ast_debug(1, "stun to %s:%d\n",
+			ast_inet_ntoa(stunaddr.sin_addr) , ntohs(stunaddr.sin_port));
+		ast_stun_request(sipsock, &stunaddr,
+			NULL, &externip);
+		ast_debug(1, "STUN sees us at %s:%d\n", 
+			ast_inet_ntoa(externip.sin_addr) , ntohs(externip.sin_port));
 	}
 	ast_mutex_unlock(&netlock);
 




More information about the asterisk-commits mailing list