From bd28a2c9c2be5409dfd6b1f7d7d25f61126e0957 Mon Sep 17 00:00:00 2001 From: Wenpeng Song <wenpeng.song@iopsys.eu> Date: Wed, 30 Apr 2025 09:51:13 +0200 Subject: [PATCH] Unregister request should be sent out only while registered While trigger the registration through cli cmd 'pjsip send register {arg}', the un-register request is sent regardless if it was registered or not. This caused issues while it was not registered, the un-register request will fall into recovery or retry mechanism if the un-register request sent failed, and will keep trying with expire=0 (un-register), hence no regular register could be sent out. --- res/res_pjsip_outbound_registration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c index abfcdddec6..9ed4056fea 100644 --- a/res/res_pjsip_outbound_registration.c +++ b/res/res_pjsip_outbound_registration.c @@ -3274,7 +3274,7 @@ static int unregister_task(void *obj) if (pjsip_regc_unregister(client, &tdata) == PJ_SUCCESS && add_configured_supported_headers(state->client_state, tdata)) { - if (registration_client_send(state->client_state, tdata) == PJ_SUCCESS) { + if (state->client_state->status == SIP_REGISTRATION_REGISTERED && registration_client_send(state->client_state, tdata) == PJ_SUCCESS) { if (sip_uri) ast_log_dt(LOG_EVENT_CODE_IPX002, (int) sip_uri->user.slen, sip_uri->user.ptr, (int) sip_uri->host.slen, sip_uri->host.ptr); -- GitLab