diff options
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 455516e4c..5bb560691 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) { |