[asterisk-commits] mjordan: branch 11 r380480 - /branches/11/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 30 09:08:03 CST 2013


Author: mjordan
Date: Wed Jan 30 09:07:59 2013
New Revision: 380480

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380480
Log:
Unregister SIP provider API if module load is declined

A user in #asterisk ran into a problem where a configuration error prevented
the chan_sip module from being loaded. Upon fixing their configuratione error,
they could no longer load the chan_sip module. This was because the
configuration checking happened after the SIP provider was registered with the
Asterisk core, and subsequent attempts to load the SIP module failed as the
provider was already registered.

Since we want to detect any failure in registering chan_sip as early as
possible (as that could be emblematic of a deeper mismatch between module
and Asterisk core), this patch does not change the registration location, but
does ensure that if a module load is declined, we unregister the module as
the SIP api provider.


Modified:
    branches/11/channels/chan_sip.c

Modified: branches/11/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_sip.c?view=diff&rev=380480&r1=380479&r2=380480
==============================================================================
--- branches/11/channels/chan_sip.c (original)
+++ branches/11/channels/chan_sip.c Wed Jan 30 09:07:59 2013
@@ -34166,7 +34166,6 @@
 
 	if (!(io = io_context_create())) {
 		ast_log(LOG_ERROR, "Unable to create I/O context\n");
-		ast_sched_context_destroy(sched);
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
@@ -34174,6 +34173,7 @@
 
 	can_parse_xml = sip_is_xml_parsable();
 	if (reload_config(sip_reloadreason)) {	/* Load the configuration from sip.conf */
+		ast_sip_api_provider_unregister();
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
@@ -34244,11 +34244,13 @@
 	initialize_escs();
 
 	if (sip_epa_register(&cc_epa_static_data)) {
+		ast_sip_api_provider_unregister();
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
 	if (sip_reqresp_parser_init() == -1) {
 		ast_log(LOG_ERROR, "Unable to initialize the SIP request and response parser\n");
+		ast_sip_api_provider_unregister();
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
@@ -34257,13 +34259,16 @@
 		 * in incoming PUBLISH requests
 		 */
 		if (ast_cc_agent_register(&sip_cc_agent_callbacks)) {
+			ast_sip_api_provider_unregister();
 			return AST_MODULE_LOAD_DECLINE;
 		}
 	}
 	if (ast_cc_monitor_register(&sip_cc_monitor_callbacks)) {
+		ast_sip_api_provider_unregister();
 		return AST_MODULE_LOAD_DECLINE;
 	}
 	if (!(sip_monitor_instances = ao2_container_alloc(37, sip_monitor_instance_hash_fn, sip_monitor_instance_cmp_fn))) {
+		ast_sip_api_provider_unregister();
 		return AST_MODULE_LOAD_DECLINE;
 	}
 




More information about the asterisk-commits mailing list