From 0e0573d0d64aea58d1fb45a19475ae2fb6922f44 Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Mon, 29 Jul 2024 13:48:29 +0700 Subject: [PATCH] Assertion due to deleted account during incoming call in PJSUA2 (#4024) --- pjsip/src/pjsua-lib/pjsua_call.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c index 4b7e53c4f..9bd7ca434 100644 --- a/pjsip/src/pjsua-lib/pjsua_call.c +++ b/pjsip/src/pjsua-lib/pjsua_call.c @@ -2141,7 +2141,7 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata) */ if (dlg->mod_data[pjsua_var.mod.id] == NULL) { /* In PJSUA2, on_incoming_call() may be called from - * on_media_transport_created() hence this might already set + * on_create_media_transport() hence this might already set * to allow notification about fail events via on_call_state() and * on_call_tsx_state(). */ @@ -2167,7 +2167,12 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata) * otherwise hangup the call with 480 */ if (pjsua_var.ua_cfg.cb.on_incoming_call) { - pjsua_var.ua_cfg.cb.on_incoming_call(acc_id, call_id, rdata); + /* For PJSUA2, avoid invoking this callback again when it has been + * invoked from on_create_media_transport(). + */ + if (call->incoming_data) { + pjsua_var.ua_cfg.cb.on_incoming_call(acc_id, call_id, rdata); + } /* Notes: * - the call might be reset when it's rejected or hangup @@ -2178,6 +2183,7 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata) * answer/hangup should have been delayed (see #1923), * so let's process the answer/hangup now. */ + if (call->async_call.call_var.inc_call.hangup) { process_pending_call_hangup(call); } else if (call->med_ch_cb == NULL && call->inv) {