summaryrefslogtreecommitdiff
path: root/res/res_pjsip.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_pjsip.c')
-rw-r--r--res/res_pjsip.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index aa6a500cd..e5af28ca8 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3520,14 +3520,21 @@ static int reload_module(void)
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;
@@ -3535,16 +3542,6 @@ static int unload_pjsip(void *data)
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
*/