[asterisk-commits] mmichelson: branch 1.6.2 r187564 - in /branches/1.6.2: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 9 16:09:06 CDT 2009


Author: mmichelson
Date: Thu Apr  9 16:09:02 2009
New Revision: 187564

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=187564
Log:
Merge revision 187488 from trunk.


Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/channels/chan_sip.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.2/channels/chan_sip.c?view=diff&rev=187564&r1=187563&r2=187564
==============================================================================
--- branches/1.6.2/channels/chan_sip.c (original)
+++ branches/1.6.2/channels/chan_sip.c Thu Apr  9 16:09:02 2009
@@ -18768,12 +18768,25 @@
 	}
 
 	if (!req->ignore && p->pendinginvite) {
-		/* We already have a pending invite. Sorry. You are on hold. */
-		p->glareinvite = seqno;     /* must hold on to this seqno to process ack and retransmit correctly */
-		transmit_response_reliable(p, "491 Request Pending", req);
-		ast_debug(1, "Got INVITE on call where we already have pending INVITE, deferring that - %s\n", p->callid);
-		/* Don't destroy dialog here */
-		return 0;
+		if (!ast_test_flag(&p->flags[0], SIP_OUTGOING) && ast_test_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED)) {
+			/* We have received a reINVITE on an incoming call to which we have sent a 200 OK but not yet received
+			 * an ACK. According to RFC 5407, Section 3.1.4, the proper way to handle this race condition is to accept
+			 * the reINVITE since we have established a dialog.
+			 */
+			 
+			/* Note that this will both clear the pendinginvite flag and cancel the 
+			 * retransmission of the 200 OK. Basically, we're accepting this reINVITE as both an ACK
+			 * and a reINVITE in one request.
+			 */
+			__sip_ack(p, p->lastinvite, 1, 0);
+		} else {
+			/* We already have a pending invite. Sorry. You are on hold. */
+			p->glareinvite = seqno;     /* must hold on to this seqno to process ack and retransmit correctly */
+			transmit_response_reliable(p, "491 Request Pending", req);
+			ast_debug(1, "Got INVITE on call where we already have pending INVITE, deferring that - %s\n", p->callid);
+			/* Don't destroy dialog here */
+			return 0;
+		}
 	}
 
 	p_replaces = get_header(req, "Replaces");




More information about the asterisk-commits mailing list