diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2016-05-24 07:37:16 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2016-05-24 07:37:16 +0000 |
commit | 064b491d6efe1394c9778f1e7eee0fec638bcbd6 (patch) | |
tree | 72da10b34300abf6b82c846ed0d9ba4e43b7d52a /pjsip/src | |
parent | 2c11f554d882b23a482cbc5c83eb1f61b1e1c114 (diff) |
Fix #1923: Delay call-answer triggered from simulated onIncomingCall() to avoid assertion.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5314 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_call.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c index 638ae3cf..cd8c227f 100644 --- a/pjsip/src/pjsua-lib/pjsua_call.c +++ b/pjsip/src/pjsua-lib/pjsua_call.c @@ -953,6 +953,10 @@ static void process_pending_call_answer(pjsua_call *call) { struct call_answer *answer, *next; + /* No initial answer yet, this function should be called again later */ + if (!call->inv->last_answer) + return; + answer = call->async_call.call_var.inc_call.answers.next; while (answer != &call->async_call.call_var.inc_call.answers) { next = answer->next; @@ -1630,6 +1634,14 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata) */ if (pjsua_var.ua_cfg.cb.on_incoming_call) { pjsua_var.ua_cfg.cb.on_incoming_call(acc_id, call_id, rdata); + + /* onIncomingCall() may be simulated by onCreateMediaTransport() + * when media init is done synchrounously (see #1916). And if app + * happens to answer the call from the callback, the answer should + * have been delayed (see #1923), so let's process the answer now. + */ + if (call->med_ch_cb == NULL) + process_pending_call_answer(call); } else { pjsua_call_hangup(call_id, PJSIP_SC_TEMPORARILY_UNAVAILABLE, NULL, NULL); @@ -2218,8 +2230,10 @@ PJ_DEF(pj_status_t) pjsua_call_answer2(pjsua_call_id call_id, /* If media transport creation is not yet completed, we will answer * the call in the media transport creation callback instead. + * Or if initial answer is not sent yet, we will answer the call after + * initial answer is sent (see #1923). */ - if (call->med_ch_cb) { + if (call->med_ch_cb || !call->inv->last_answer) { struct call_answer *answer; PJ_LOG(4,(THIS_FILE, "Pending answering call %d upon completion " |