[asterisk-commits] dvossel: trunk r271977 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 22 15:37:10 CDT 2010


Author: dvossel
Date: Tue Jun 22 15:37:05 2010
New Revision: 271977

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=271977
Log:
ignore CANCEL request after having already received final response to INVITE

RFC 3261 section 9 states that a CANCEL has no effect on a
request to a UAS that has already given a final response.  This
patch checks to make sure there is a pending invite before
allowing a CANCEL request to be processed, otherwise it responds
to the CANCEL with a "481 Call/Transaction Does Not Exist".

Review: https://reviewboard.asterisk.org/r/697/


Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=271977&r1=271976&r2=271977
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Jun 22 15:37:05 2010
@@ -23079,7 +23079,14 @@
 		req->ignore = 1;
 		ast_debug(3, "Ignoring SIP message because of retransmit (%s Seqno %d, ours %d)\n", sip_methods[p->method].text, p->icseq, seqno);
 	}
-		
+
+	/* RFC 3261 section 9. "CANCEL has no effect on a request to which a UAS has
+	 * already given a final response." */
+	if (!p->pendinginvite && (req->method == SIP_CANCEL)) {
+		transmit_response(p, "481 Call/Transaction Does Not Exist", req);
+		return res;
+	}
+
 	if (seqno >= p->icseq)
 		/* Next should follow monotonically (but not necessarily
 		   incrementally -- thanks again to the genius authors of SIP --




More information about the asterisk-commits mailing list