diff options
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_call.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c index 45e21326..f4faaf49 100644 --- a/pjsip/src/pjsua-lib/pjsua_call.c +++ b/pjsip/src/pjsua-lib/pjsua_call.c @@ -1381,7 +1381,9 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata) * a response message and terminate the invite here. */ pjsip_dlg_respond(dlg, rdata, sip_err_code, NULL, NULL, NULL); - pjsip_inv_terminate(call->inv, sip_err_code, PJ_FALSE); + if (call->inv && call->inv->dlg) { + pjsip_inv_terminate(call->inv, sip_err_code, PJ_FALSE); + } call->inv = NULL; call->async_call.dlg = NULL; goto on_return; @@ -1389,7 +1391,9 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata) } else if (status != PJ_EPENDING) { pjsua_perror(THIS_FILE, "Error initializing media channel", status); pjsip_dlg_respond(dlg, rdata, sip_err_code, NULL, NULL, NULL); - pjsip_inv_terminate(call->inv, sip_err_code, PJ_FALSE); + if (call->inv && call->inv->dlg) { + pjsip_inv_terminate(call->inv, sip_err_code, PJ_FALSE); + } call->inv = NULL; call->async_call.dlg = NULL; goto on_return; |