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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 18 11:20:45 CDT 2009


Author: dvossel
Date: Fri Sep 18 11:20:41 2009
New Revision: 219451

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=219451
Log:
Merged revisions 219450 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r219450 | dvossel | 2009-09-18 11:19:15 -0500 (Fri, 18 Sep 2009) | 14 lines
  
  via-header branches not updated correctly on INVITE
  
  INVITE requests must always contain a new unique branch id. When
  a new branch id is created for an INVITE, the dialog's invite_branch
  variable must be updated so CANCEL requests use the correct branch id.
  
  (closes issue #15262)
  Reported by: maniax
  Patches:
        asterisk-1.6.1.0-sip-branch.patch uploaded by tweety (license 608)
        invite_new_branch_trunk.diff uploaded by dvossel (license 671)
  Tested by: maniax, dvossel
........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=219451&r1=219450&r2=219451
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Sep 18 11:20:41 2009
@@ -9390,12 +9390,13 @@
 		seqno = p->ocseq;
 	}
 	
-	/* A CANCEL must have the same branch as the INVITE that it is canceling.
-	 * Similarly, if we need to re-send an INVITE with auth credentials, then we
-	 * need to use the same branch as we did the first time we sent the INVITE.
-	 */
-	if (sipmethod == SIP_CANCEL || (sipmethod == SIP_INVITE && p->options && !ast_strlen_zero(p->options->auth))) {
+	/* A CANCEL must have the same branch as the INVITE that it is canceling. */
+	if (sipmethod == SIP_CANCEL) {
 		p->branch = p->invite_branch;
+		build_via(p);
+	} else if (newbranch && (sipmethod == SIP_INVITE)) {
+		p->branch ^= ast_random();
+		p->invite_branch = p->branch;
 		build_via(p);
 	} else if (newbranch) {
 		p->branch ^= ast_random();




More information about the asterisk-commits mailing list