[asterisk-commits] trunk r12400 - /trunk/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Mar 7 13:47:26 MST 2006


Author: oej
Date: Tue Mar  7 14:47:24 2006
New Revision: 12400

URL: http://svn.digium.com/view/asterisk?rev=12400&view=rev
Log:
Issue #6627 - Don't reset port number of active peers at 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?rev=12400&r1=12399&r2=12400&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Mar  7 14:47:24 2006
@@ -12040,14 +12040,19 @@
 /*! \brief Set peer defaults before configuring specific configurations */
 static void set_peer_defaults(struct sip_peer *peer)
 {
-	peer->expire = -1;
-	peer->pokeexpire = -1;
+	if (peer->expire == 0) {
+		/* Don't reset expire or port time during reload 
+		   if we have an active registration 
+		*/
+		peer->expire = -1;
+		peer->pokeexpire = -1;
+		peer->addr.sin_port = htons(DEFAULT_SIP_PORT);
+	}
 	ast_copy_flags(peer, &global_flags, SIP_FLAGS_TO_COPY);
 	strcpy(peer->context, default_context);
 	strcpy(peer->subscribecontext, default_subscribecontext);
 	strcpy(peer->language, default_language);
 	strcpy(peer->musicclass, default_musicclass);
-	peer->addr.sin_port = htons(DEFAULT_SIP_PORT);
 	peer->addr.sin_family = AF_INET;
 	peer->defaddr.sin_family = AF_INET;
 	peer->capability = global_capability;
@@ -12127,8 +12132,6 @@
 		else
 			speerobjs++;
 		ASTOBJ_INIT(peer);
-		peer->expire = -1;
-		peer->pokeexpire = -1;
 	}
 	/* Note that our peer HAS had its reference count incrased */
 
@@ -12136,12 +12139,9 @@
 	oldha = peer->ha;
 	peer->ha = NULL;
 	set_peer_defaults(peer);	/* Set peer defaults */
-	if (!found) {
-		if (name)
+	if (!found && name)
 			ast_copy_string(peer->name, name, sizeof(peer->name));
-		peer->addr.sin_port = htons(DEFAULT_SIP_PORT);
-		peer->addr.sin_family = AF_INET;
-	}
+
 	/* If we have channel variables, remove them (reload) */
 	if (peer->chanvars) {
 		ast_variables_destroy(peer->chanvars);



More information about the asterisk-commits mailing list