From b527491619af72e4c2da6a0cc25012b5995324ca Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Fri, 21 Oct 2011 09:39:40 +0000 Subject: Fixed #1391: Missing CSeq check for incoming ACK in an INVITE session (thanks Ilya Kalinin for the report) git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3834 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip-ua/sip_inv.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c index b377beb4..6b4d649f 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -455,17 +455,25 @@ static pj_bool_t mod_inv_on_rx_request(pjsip_rx_data *rdata) */ if (method->id == PJSIP_ACK_METHOD && inv) { + /* Ignore if we don't have INVITE in progress */ + if (!inv->invite_tsx) { + return PJ_TRUE; + } + /* Ignore ACK if pending INVITE transaction has not finished. */ - if (inv->invite_tsx && - inv->invite_tsx->state < PJSIP_TSX_STATE_COMPLETED) - { + if (inv->invite_tsx->state < PJSIP_TSX_STATE_COMPLETED) { + return PJ_TRUE; + } + + /* Ignore ACK with different CSeq + * https://trac.pjsip.org/repos/ticket/1391 + */ + if (rdata->msg_info.cseq->cseq != inv->invite_tsx->cseq) { return PJ_TRUE; } /* Terminate INVITE transaction, if it's still present. */ - if (inv->invite_tsx && - inv->invite_tsx->state <= PJSIP_TSX_STATE_COMPLETED) - { + if (inv->invite_tsx->state <= PJSIP_TSX_STATE_COMPLETED) { /* Before we terminate INVITE transaction, process the SDP * in the ACK request, if any. * Only do this when invite state is not already disconnected -- cgit v1.2.3