]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_outbound_publishing: After unloading the library won't load again 05/2805/1
authorKevin Harwell <kharwell@digium.com>
Tue, 3 May 2016 20:35:24 +0000 (15:35 -0500)
committerKevin Harwell <kharwell@digium.com>
Wed, 11 May 2016 16:41:21 +0000 (11:41 -0500)
The same thing was happening in res_pjsip_publish_asterisk. When the library
was unloaded it did not unregister the object type from sorcery. Subsequent
loads resulted in a failed load due to the sorcery type already existing.

Change-Id: Ifdc25e94e4cd40bc5a19eb4d0a00b86c2e9fedc9

res/res_pjsip_outbound_publish.c
res/res_pjsip_publish_asterisk.c

index 60f9bbb177497d694a50dd0fa074ec781df992c8..073a2d1ed6974799affe59e45d1b9cb1aed237b5 100644 (file)
@@ -1141,6 +1141,7 @@ static int load_module(void)
 
        if (ast_sorcery_object_register(ast_sip_get_sorcery(), "outbound-publish", sip_outbound_publish_alloc, NULL,
                sip_outbound_publish_apply)) {
+               ast_log(LOG_ERROR, "Unable to register 'outbound-publish' type with sorcery\n");
                return AST_MODULE_LOAD_DECLINE;
        }
 
@@ -1213,6 +1214,7 @@ static int unload_module(void)
                        "in the allowed time\n", unloading.count);
        } else {
                ast_verb(5, "All items successfully unpublished\n");
+               ast_sorcery_object_unregister(ast_sip_get_sorcery(), "outbound-publish");
        }
 
        return res;
index 3218b0a0cd331c66108453e74b2360e4232598a0..002d976d42e93dd828ede0e418adffea339bab69 100644 (file)
@@ -862,6 +862,7 @@ static int load_module(void)
        ast_sorcery_apply_default(ast_sip_get_sorcery(), "asterisk-publication", "config", "pjsip.conf,criteria=type=asterisk-publication");
 
        if (ast_sorcery_object_register(ast_sip_get_sorcery(), "asterisk-publication", asterisk_publication_config_alloc, NULL, NULL)) {
+               ast_log(LOG_ERROR, "Unable to register 'asterisk-publication' type with sorcery\n");
                return AST_MODULE_LOAD_DECLINE;
        }
 
@@ -919,6 +920,7 @@ static int unload_module(void)
        ast_sip_unregister_publish_handler(&asterisk_mwi_publication_handler);
        ast_sip_unregister_event_publisher_handler(&asterisk_devicestate_publisher_handler);
        ast_sip_unregister_event_publisher_handler(&asterisk_mwi_publisher_handler);
+       ast_sorcery_object_unregister(ast_sip_get_sorcery(), "asterisk-publication");
        return 0;
 }