static int unload_pjsip(void *data)
{
ast_cli_unregister_multiple(cli_commands, ARRAY_LEN(cli_commands));
+ ast_res_pjsip_cleanup_options_handling();
+ internal_sip_destroy_outbound_authentication();
+ ast_sip_destroy_distributor();
+ ast_res_pjsip_destroy_configuration();
+ ast_sip_destroy_system();
+ ast_sip_destroy_global_headers();
+ internal_sip_unregister_service(&supplement_module);
+ if (monitor_thread) {
+ stop_monitor_thread();
+ }
if (memory_pool) {
pj_pool_release(memory_pool);
memory_pool = NULL;
}
- if (ast_pjsip_endpoint) {
- pjsip_endpt_destroy(ast_pjsip_endpoint);
- ast_pjsip_endpoint = NULL;
- }
+ ast_pjsip_endpoint = NULL;
pj_caching_pool_destroy(&caching_pool);
pj_shutdown();
return 0;
static int unload_module(void)
{
- ast_res_pjsip_cleanup_options_handling();
- internal_sip_destroy_outbound_authentication();
- ast_sip_destroy_distributor();
- ast_res_pjsip_destroy_configuration();
- ast_sip_destroy_system();
- ast_sip_destroy_global_headers();
- internal_sip_unregister_service(&supplement_module);
- if (monitor_thread) {
- stop_monitor_thread();
- }
/* The thread this is called from cannot call PJSIP/PJLIB functions,
* so we have to push the work to the threadpool to handle
*/
ast_sorcery_observer_add(ast_sip_get_sorcery(), "global", &keepalive_global_observer);
ast_sorcery_reload_object(ast_sip_get_sorcery(), "global");
- ast_module_ref(ast_module_info->self);
+ ast_module_shutdown_ref(ast_module_info->self);
return AST_MODULE_LOAD_SUCCESS;
}
}
ast_sip_register_service(&session_reinvite_module);
- ast_module_ref(ast_module_info->self);
+ ast_module_shutdown_ref(ast_module_info->self);
return AST_MODULE_LOAD_SUCCESS;
}
static int unload_module(void)
{
- /* This will never get called as this module can't be unloaded */
+ ast_sip_unregister_service(&session_reinvite_module);
+ ast_sip_unregister_service(&session_module);
+ ast_sorcery_delete(ast_sip_get_sorcery(), nat_hook);
+ ao2_cleanup(nat_hook);
+ ao2_cleanup(sdp_handlers);
return 0;
}