diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-10 20:20:53 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-10 20:20:53 +0000 |
commit | 8e2665d4885fbcaa4d89c97dd12823e1e8f33060 (patch) | |
tree | fbe93eaeaeaea5f417faa752ffecd9bb3bbfbce5 /channels/chan_sip.c | |
parent | 12ec4a26530435cf291f64740a889a87ac88ecd9 (diff) |
The 1.6.0 branch was missing all invite_branch logic. It has now been added.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@199975 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index dba3506ff..ea333ed15 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1254,6 +1254,7 @@ 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 */ @@ -7805,8 +7806,15 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in p->ocseq++; seqno = p->ocseq; } - - if (newbranch) { + + /* 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 && !ast_strlen_zero(p->options->auth))) { + p->branch = p->invite_branch; + build_via(p); + } else if (newbranch) { p->branch ^= ast_random(); build_via(p); } @@ -9134,6 +9142,7 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init) req.method = sipmethod; if (init) {/* Bump branch even on initial requests */ p->branch ^= ast_random(); + p->invite_branch = p->branch; build_via(p); } if (init > 1) |