diff options
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 78c2e8acc..66d06d2e2 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -16660,6 +16660,36 @@ static int reload_config(enum channelreloadreason reason) return -1; } + if (option_debug > 3) + ast_log(LOG_DEBUG, "--------------- SIP reload started\n"); + + clear_realm_authentication(authl); + clear_sip_domains(); + authl = NULL; + + /* First, destroy all outstanding registry calls */ + /* This is needed, since otherwise active registry entries will not be destroyed */ + ASTOBJ_CONTAINER_TRAVERSE(®l, 1, do { + ASTOBJ_RDLOCK(iterator); + if (iterator->call) { + if (option_debug > 2) + ast_log(LOG_DEBUG, "Destroying active SIP dialog for registry %s@%s\n", iterator->username, iterator->hostname); + /* This will also remove references to the registry */ + sip_destroy(iterator->call); + } + ASTOBJ_UNLOCK(iterator); + + } while(0)); + + /* Then, actually destroy users and registry */ + ASTOBJ_CONTAINER_DESTROYALL(&userl, sip_destroy_user); + if (option_debug > 3) + ast_log(LOG_DEBUG, "--------------- Done destroying user list\n"); + ASTOBJ_CONTAINER_DESTROYALL(®l, sip_registry_destroy); + if (option_debug > 3) + ast_log(LOG_DEBUG, "--------------- Done destroying registry list\n"); + ASTOBJ_CONTAINER_MARKALL(&peerl); + /* Initialize copy of current global_regcontext for later use in removing stale contexts */ ast_copy_string(oldcontexts, global_regcontext, sizeof(oldcontexts)); oldregcontext = oldcontexts; @@ -17668,35 +17698,6 @@ static void sip_send_all_registers(void) /*! \brief Reload module */ static int sip_do_reload(enum channelreloadreason reason) { - if (option_debug > 3) - ast_log(LOG_DEBUG, "--------------- SIP reload started\n"); - - clear_realm_authentication(authl); - clear_sip_domains(); - authl = NULL; - - /* First, destroy all outstanding registry calls */ - /* This is needed, since otherwise active registry entries will not be destroyed */ - ASTOBJ_CONTAINER_TRAVERSE(®l, 1, do { - ASTOBJ_RDLOCK(iterator); - if (iterator->call) { - if (option_debug > 2) - ast_log(LOG_DEBUG, "Destroying active SIP dialog for registry %s@%s\n", iterator->username, iterator->hostname); - /* This will also remove references to the registry */ - sip_destroy(iterator->call); - } - ASTOBJ_UNLOCK(iterator); - - } while(0)); - - /* Then, actually destroy users and registry */ - ASTOBJ_CONTAINER_DESTROYALL(&userl, sip_destroy_user); - if (option_debug > 3) - ast_log(LOG_DEBUG, "--------------- Done destroying user list\n"); - ASTOBJ_CONTAINER_DESTROYALL(®l, sip_registry_destroy); - if (option_debug > 3) - ast_log(LOG_DEBUG, "--------------- Done destroying registry list\n"); - ASTOBJ_CONTAINER_MARKALL(&peerl); reload_config(reason); /* Prune peers who still are supposed to be deleted */ |