summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2012-09-28 10:07:22 +0000
committerNanang Izzuddin <nanang@teluu.com>2012-09-28 10:07:22 +0000
commitf08802c585d30e01ea5dce2bdc222b8ecaa47552 (patch)
tree3f5b7c2ffe2ec22ce18389bbf3cd2ac063d62edd /pjsip
parentbea8edcb195eda3e316b67c29ecceca22db3ef1e (diff)
Re #1587: Respond to call replace request with the last provisional response sent in the replaced call.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4269 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index c374f0dc..d5856f5b 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -811,8 +811,8 @@ static pj_status_t process_incoming_call_replace(pjsua_call *call,
{
pjsip_inv_session *replaced_inv;
struct pjsua_call *replaced_call;
- pjsip_tx_data *tdata;
- pj_status_t status;
+ pjsip_tx_data *tdata = NULL;
+ pj_status_t status = PJ_SUCCESS;
/* Get the invite session in the dialog */
replaced_inv = pjsip_dlg_get_inv_session(replaced_dlg);
@@ -828,9 +828,17 @@ static pj_status_t process_incoming_call_replace(pjsua_call *call,
if (replaced_call->inv->state <= PJSIP_INV_STATE_EARLY &&
replaced_call->inv->role != PJSIP_ROLE_UAC)
{
- /* Replaced call is not in confirmed state yet and we are not
- * the call initiator, should not answer with 200 response here.
- */
+ if (replaced_call->last_code > 100 && replaced_call->last_code < 200)
+ {
+ pjsip_status_code code = replaced_call->last_code;
+ pj_str_t *text = &replaced_call->last_text;
+
+ PJ_LOG(4,(THIS_FILE, "Answering replacement call %d with %d/%.*s",
+ call->index, code, text->slen, text->ptr));
+
+ /* Answer the new call with last response in the replaced call */
+ status = pjsip_inv_answer(call->inv, code, text, NULL, &tdata);
+ }
} else {
PJ_LOG(4,(THIS_FILE, "Answering replacement call %d with 200/OK",
call->index));
@@ -839,7 +847,7 @@ static pj_status_t process_incoming_call_replace(pjsua_call *call,
status = pjsip_inv_answer(call->inv, 200, NULL, NULL, &tdata);
}
- if (status == PJ_SUCCESS)
+ if (status == PJ_SUCCESS && tdata)
status = pjsip_inv_send_msg(call->inv, tdata);
if (status != PJ_SUCCESS)