diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-09-09 19:15:28 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-09-09 19:15:28 +0000 |
commit | 2971f1aa41c4baa873ebb35f7c8aaa564bb7c637 (patch) | |
tree | 3fcf2ad4e28933147f35f0c940fce6e01fe005bf /channels | |
parent | fa1510f6662856d2543fd343c6f0add1b30b6900 (diff) |
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
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@142218 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index aa02eef22..6f205a381 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -973,6 +973,7 @@ static struct sip_pvt { 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 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in 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 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init) 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); |