From 45a544797fe4ad613385965bd002973cdd80be2c Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Mon, 27 Feb 2012 09:12:13 +0000 Subject: 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 --- pjsip/src/pjsip-ua/sip_inv.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'pjsip') 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 @@ -3849,6 +3849,32 @@ static void inv_on_state_connecting( pjsip_inv_session *inv, pjsip_event *e) status = pjsip_dlg_send_response(dlg, tsx, tdata); if (status != PJ_SUCCESS) return; + } 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); + } } -- cgit v1.2.3