diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 845769dfe01356ad9ef5f0821589b4c7c494a95b..dc6f3f38c9c709dfc87f9fc9e27a618f40340151 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -13041,6 +13041,19 @@ static int sip_do_reload(enum channelreloadreason reason) 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)); + ASTOBJ_CONTAINER_DESTROYALL(&userl, sip_destroy_user); ASTOBJ_CONTAINER_DESTROYALL(®l, sip_registry_destroy); ASTOBJ_CONTAINER_MARKALL(&peerl);