Skip to content

Commit 37c16f9

Browse files
committed
res_pjsip: delay contact pruning on Asterisk start
Move the call to ast_sip_location_prune_boot_contacts() *after* the call to ast_res_pjsip_init_options_handling() so that res/res_pjsip/pjsip_options.c is informed about the contact deletion and updates its sip_options_contact_statuses list. This allows for an AMI event to be sent by res/res_pjsip/pjsip_options.c if the endpoint registers again from the same remote address and port (i.e., same URI) as used before the Asterisk restart. ASTERISK-30109 Reported-by: Michael Neuhauser Change-Id: I1ba4478019e4931a7085f62708d9b66837e901a8
1 parent f2f397c commit 37c16f9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

res/res_pjsip.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2766,6 +2766,14 @@ static int load_module(void)
27662766
goto error;
27672767
}
27682768

2769+
/*
2770+
* It is OK to prune the contacts now that
2771+
* ast_res_pjsip_init_options_handling() has added the contact observer
2772+
* of res/res_pjsip/pjsip_options.c to sorcery (to ensure that any
2773+
* pruned contacts are removed from this module's data structure).
2774+
*/
2775+
ast_sip_location_prune_boot_contacts();
2776+
27692777
if (ast_res_pjsip_init_message_filter()) {
27702778
ast_log(LOG_ERROR, "Failed to initialize message IP updating. Aborting load\n");
27712779
goto error;

res/res_pjsip/pjsip_configuration.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,8 +2280,6 @@ int ast_res_pjsip_initialize_configuration(void)
22802280

22812281
load_all_endpoints();
22822282

2283-
ast_sip_location_prune_boot_contacts();
2284-
22852283
acl_change_sub = stasis_subscribe(ast_security_topic(), acl_change_stasis_cb, NULL);
22862284
stasis_subscription_accept_message_type(acl_change_sub, ast_named_acl_change_type());
22872285
stasis_subscription_set_filter(acl_change_sub, STASIS_SUBSCRIPTION_FILTER_SELECTIVE);

0 commit comments

Comments
 (0)