diff options
author | Matthew Jordan <mjordan@digium.com> | 2013-01-30 15:57:41 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2013-01-30 15:57:41 +0000 |
commit | 01309cf41ea95473d0234cbf1bb19a0a1417b45f (patch) | |
tree | 37b409a87e9431fb4e755d83d85c4ce02c79d49e /channels/chan_sip.c | |
parent | 8018bdd8e1327047ebfb687f6e97ad2fa396fab1 (diff) |
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.
........
Merged revisions 380480 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index b547edb23..1d9c2d982 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -34331,7 +34331,6 @@ static int load_module(void) 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; } @@ -34339,6 +34338,7 @@ static int load_module(void) 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; } @@ -34409,11 +34409,13 @@ static int load_module(void) 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; } @@ -34422,13 +34424,16 @@ static int load_module(void) * 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; } |