[Freeswitch-svn] [commit] r12901 - freeswitch/trunk/src/mod/endpoints/mod_sofia

FreeSWITCH SVN anthm at freeswitch.org
Fri Apr 3 06:14:26 PDT 2009


Author: anthm
Date: Fri Apr  3 08:14:26 2009
New Revision: 12901

Log:
don't unregister not registered gateways

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	Fri Apr  3 08:14:26 2009
@@ -67,9 +67,19 @@
 static void sofia_reg_kill_reg(sofia_gateway_t *gateway_ptr)
 {
 
+	if (gateway_ptr->state != REG_STATE_REGED) {
+		if (gateway_ptr->nh) {
+			nua_handle_destroy(gateway_ptr->nh);
+			gateway_ptr->nh = NULL;
+		}
+		return;
+	}
+	
+	/*
 	if (!gateway_ptr->nh) {
 		sofia_reg_new_handle(gateway_ptr, SWITCH_FALSE);
 	}
+	*/
 
 	if (gateway_ptr->nh) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "UN-Registering %s\n", gateway_ptr->name);
@@ -80,6 +90,8 @@
 					   TAG_END());
 	}
 	
+
+
 }
 
 static void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway) {
@@ -100,7 +112,9 @@
 			sofia_private_free(gateway_ptr->sofia_private);
 		}
 
-		sofia_reg_kill_reg(gateway_ptr);
+		if (gateway_ptr->state == REG_STATE_REGED) {
+			sofia_reg_kill_reg(gateway_ptr);
+		}
 
 	}
 }



More information about the Freeswitch-svn mailing list