From: Mark Michelson Date: Wed, 12 Aug 2009 18:46:09 +0000 (+0000) Subject: Backport fix so that outbound CANCEL requests have same branch as challenged INVITEs. X-Git-Tag: 1.4.26.2~4^2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad76c4055168195a7163d1f05ef68e50a7c1c87e;p=thirdparty%2Fasterisk.git Backport fix so that outbound CANCEL requests have same branch as challenged INVITEs. There already was code present to be sure that a CANCEL will contain the same branch-id as the INVITE it is cancelling. However, for INVITES which are challenged downstream, this mechanism did not work properly. Now this is taken care of. This is a backport of a fix already present in all 1.6.X branches and in trunk. It also fixes ABE-1907. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@211807 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 455516e4c9..5bb560691c 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -6264,7 +6264,11 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in seqno = p->ocseq; } - if (sipmethod == SIP_CANCEL) { + /* 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))) { p->branch = p->invite_branch; build_via(p); } else if (newbranch) {