diff --git a/res/res_pjsip.c b/res/res_pjsip.c index d722bbe0fd..2febf3de87 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -2766,6 +2766,14 @@ static int load_module(void) goto error; } + /* + * It is OK to prune the contacts now that + * ast_res_pjsip_init_options_handling() has added the contact observer + * of res/res_pjsip/pjsip_options.c to sorcery (to ensure that any + * pruned contacts are removed from this module's data structure). + */ + ast_sip_location_prune_boot_contacts(); + if (ast_res_pjsip_init_message_filter()) { ast_log(LOG_ERROR, "Failed to initialize message IP updating. Aborting load\n"); goto error; diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index 5f1f61e397..6bc978dae5 100644 --- a/res/res_pjsip/pjsip_configuration.c +++ b/res/res_pjsip/pjsip_configuration.c @@ -2280,8 +2280,6 @@ int ast_res_pjsip_initialize_configuration(void) load_all_endpoints(); - ast_sip_location_prune_boot_contacts(); - acl_change_sub = stasis_subscribe(ast_security_topic(), acl_change_stasis_cb, NULL); stasis_subscription_accept_message_type(acl_change_sub, ast_named_acl_change_type()); stasis_subscription_set_filter(acl_change_sub, STASIS_SUBSCRIPTION_FILTER_SELECTIVE);