[asterisk-commits] mmichelson: branch 1.4 r142218 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 9 14:15:28 CDT 2008


Author: mmichelson
Date: Tue Sep  9 14:15:28 2008
New Revision: 142218

URL: http://svn.digium.com/view/asterisk?view=rev&rev=142218
Log:
Make sure that the branch sent in CANCEL requests
matches the branch of the INVITE it is cancelling.

(closes issue #13381)
Reported by: atca_pres
Patches:
      13381v2.patch uploaded by putnopvut (license 60)
Tested by: atca_pres

(closes issue #13198)
Reported by: rickead2000
Tested by: rickead2000


Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=142218&r1=142217&r2=142218
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Tue Sep  9 14:15:28 2008
@@ -973,6 +973,7 @@
 	int authtries;				/*!< Times we've tried to authenticate */
 	int expiry;				/*!< How long we take to expire */
 	long branch;				/*!< The branch identifier of this session */
+	long invite_branch;			/*!< The branch used when we sent the initial INVITE */
 	char tag[11];				/*!< Our tag for this session */
 	int sessionid;				/*!< SDP Session ID */
 	int sessionversion;			/*!< SDP Session Version */
@@ -5980,7 +5981,10 @@
 		seqno = p->ocseq;
 	}
 	
-	if (newbranch) {
+	if (sipmethod == SIP_CANCEL) {
+		p->branch = p->invite_branch;
+		build_via(p);
+	} else if (newbranch) {
 		p->branch ^= ast_random();
 		build_via(p);
 	}
@@ -7128,6 +7132,7 @@
 	if (init) {		/* Seems like init always is 2 */
 		/* Bump branch even on initial requests */
 		p->branch ^= ast_random();
+		p->invite_branch = p->branch;
 		build_via(p);
 		if (init > 1)
 			initreqprep(&req, p, sipmethod);




More information about the asterisk-commits mailing list