summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2012-02-27 09:12:13 +0000
committerBenny Prijono <bennylp@teluu.com>2012-02-27 09:12:13 +0000
commit45a544797fe4ad613385965bd002973cdd80be2c (patch)
treebf6d0c42cf3c1a86a39b74211d48115279c60376
parentbb56d93b6c7a87ca52664f0568a59657a099f3e8 (diff)
Fixed #1455: Incoming re-INVITE is unhandled if it comes in CONNECTING state (thanks Olle Frimanson for the report)
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3959 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsip-ua/sip_inv.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
index 6b4d649f..66f9c63a 100644
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -3851,6 +3851,32 @@ static void inv_on_state_connecting( pjsip_inv_session *inv, pjsip_event *e)
} else if (tsx->role == PJSIP_ROLE_UAS &&
tsx->state == PJSIP_TSX_STATE_TRYING &&
+ pjsip_method_cmp(&tsx->method, &pjsip_invite_method)==0)
+ {
+ pjsip_rx_data *rdata = e->body.tsx_state.src.rdata;
+ pjsip_tx_data *tdata;
+ pj_status_t status;
+
+ /* See https://trac.pjsip.org/repos/ticket/1455
+ * Handle incoming re-INVITE before current INVITE is confirmed.
+ * According to RFC 5407:
+ * - answer with 200 if we don't have pending offer-answer
+ * - answer with 491 if we *have* pending offer-answer
+ *
+ * But unfortunately accepting the re-INVITE would mean we have
+ * two outstanding INVITEs, and we don't support that because
+ * we will get confused when we handle the ACK.
+ */
+ status = pjsip_dlg_create_response(inv->dlg, rdata,
+ PJSIP_SC_REQUEST_PENDING,
+ NULL, &tdata);
+ if (status != PJ_SUCCESS)
+ return;
+ pjsip_timer_update_resp(inv, tdata);
+ status = pjsip_dlg_send_response(dlg, tsx, tdata);
+
+ } else if (tsx->role == PJSIP_ROLE_UAS &&
+ tsx->state == PJSIP_TSX_STATE_TRYING &&
pjsip_method_cmp(&tsx->method, &pjsip_update_method)==0)
{
/*
@@ -3883,6 +3909,7 @@ static void inv_on_state_connecting( pjsip_inv_session *inv, pjsip_event *e)
/* Generic handling for UAC tsx completion */
handle_uac_tsx_response(inv, e);
+
}
}