[asterisk-commits] branch oej/issue5898 r8693 - /team/oej/issue5898/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 25 14:00:45 MST 2006


Author: oej
Date: Wed Jan 25 15:00:43 2006
New Revision: 8693

URL: http://svn.digium.com/view/asterisk?rev=8693&view=rev
Log:
Ok, that fixed that. Now active registrations are cancelled and properly deleted.
Will look this over tomorrow and see if it can be done in a more elegant way
before committing to 1.2 and trunk.

Modified:
    team/oej/issue5898/channels/chan_sip.c

Modified: team/oej/issue5898/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/issue5898/channels/chan_sip.c?rev=8693&r1=8692&r2=8693&view=diff
==============================================================================
--- team/oej/issue5898/channels/chan_sip.c (original)
+++ team/oej/issue5898/channels/chan_sip.c Wed Jan 25 15:00:43 2006
@@ -13057,8 +13057,22 @@
 	clear_realm_authentication(authl);
 	clear_sip_domains();
 	authl = NULL;
-
+	/* First, destroy all outstanding registry calls */
+	ASTOBJ_CONTAINER_TRAVERSE(&regl, 1, do {
+		ASTOBJ_RDLOCK(iterator);
+		if (iterator->call) {
+			if (option_debug > 2)
+				ast_log(LOG_DEBUG, "Destroying active SIP dialog for registry %s@%s\n", iterator->username, iterator->hostname);
+			/* This will also remove references to the registry */
+			sip_destroy(iterator->call);
+		}
+		ASTOBJ_UNLOCK(iterator);
+	} while(0));
+
+	/* Then, actually destroy users and registry */
 	ASTOBJ_CONTAINER_DESTROYALL(&userl, sip_destroy_user);
+	if (option_debug > 3)
+		ast_log(LOG_DEBUG, "--------------- Done destroying user list\n");
 	ASTOBJ_CONTAINER_DESTROYALL(&regl, sip_registry_destroy);
 	if (option_debug > 3)
 		ast_log(LOG_DEBUG, "--------------- Done destroying registry list\n");
@@ -13067,6 +13081,8 @@
 
 	/* Prune peers who still are supposed to be deleted */
 	ASTOBJ_CONTAINER_PRUNE_MARKED(&peerl, sip_destroy_peer);
+	if (option_debug > 3)
+		ast_log(LOG_DEBUG, "--------------- Done destroying pruned peers\n");
 
 	/* Send qualify (OPTIONS) to all peers */
 	sip_poke_all_peers();



More information about the asterisk-commits mailing list