aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-18 16:21:30 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-18 16:21:30 +0000
commitbeaee5416e737b8ae6abbb7170f173e951d91352 (patch)
treee7ae9fd6d13247d91cdadfb449227f9f2a988ac7
parent65be14756db891f0980bafbf5eb9f5686a8006db (diff)
Merged revisions 219451 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r219451 | dvossel | 2009-09-18 11:20:41 -0500 (Fri, 18 Sep 2009) | 20 lines 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 ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@219452 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 7606c1f59..ade8c64dc 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -9028,13 +9028,14 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in
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();
build_via(p);