From 79b453b5797e70ebd38ec4fe0ad1b502e2e148d0 Mon Sep 17 00:00:00 2001 From: "Joshua C. Colp" Date: Thu, 26 Mar 2020 19:42:27 -0300 Subject: [PATCH] res_pjsip: Don't set endpoint to unavailable in all cases. When an AOR is modified endpoints are updated that reference the AOR so they can start receiving updates and reflect the correct state. If this is the case then we shouldn't change the endpoint to be offline if it does not reference the AOR but instead only when the endpoint is completely updated for all its AORs. ASTERISK-28056 patches: pjsip_options-aor.diff submitted by jhord (license 6978) Change-Id: I3ee00023be2393113cd4e056599f23f3499ef164 --- res/res_pjsip/pjsip_options.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c index 2c305802fe..579165fdde 100644 --- a/res/res_pjsip/pjsip_options.c +++ b/res/res_pjsip/pjsip_options.c @@ -1667,8 +1667,11 @@ static int sip_options_synchronize_endpoint(void *obj, void *arg, int flags) ao2_unlock(task_data.endpoint_state_compositor); ao2_ref(task_data.endpoint_state_compositor, -1); - } else { - /* If there is none then they may have referenced an invalid AOR or none at all */ + } else if (!aor) { + /* If no explicit AOR is specified we are updating the endpoint itself, so then set + * it to offline if no endpoint compositor exists as they referenced an invalid AOR + * or none at all + */ ast_debug(3, "Endpoint '%s' has no AORs feeding it, setting it to offline state as default\n", ast_sorcery_object_get_id(endpoint)); ast_sip_persistent_endpoint_update_state(ast_sorcery_object_get_id(endpoint),