[asterisk-commits] mjordan: branch 11 r431620 - in /branches/11/channels: ./ sip/include/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Feb 8 20:44:27 CST 2015
Author: mjordan
Date: Sun Feb 8 20:44:24 2015
New Revision: 431620
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=431620
Log:
channels/chan_sip: Ensure that a BYE is sent during INVITE w/Replaces transfer
Consider a scenario where Alice and Bob have an established dialog with each
other external to Asterisk. Bob decides to perform an attended transfer of
Alice to Asterisk. In this case, Alice will send an INVITE with Replaces
to Asterisk, where the Replaces specifies Bob's dialog with Asterisk. In this
particular scenario, Asterisk will complete the transfer, but - since Bob's
channel has had Alice masqueraded into it and is now a Zombie - a BYE
request will not be sent.
This patch fixes that issue by adding a new flag to chan_sip that tracks
whether or not we have an INVITE with Replaces. If we do, the flag is used
on the sip_pvt to ensure that a BYE request is sent, even if the channel has
been masqueraded away.
Review: https://reviewboard.asterisk.org/r/4362/
ASTERISK-22436 #close
Reported by: Eelco Brolman
Tested by: Jeremiah Gowdy, Kristian Høgh
patches:
asterisk-11-hangup-replaced-3.diff uploaded by Jeremiah Gowdy (License 6358)
Modified:
branches/11/channels/chan_sip.c
branches/11/channels/sip/include/sip.h
Modified: branches/11/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_sip.c?view=diff&rev=431620&r1=431619&r2=431620
==============================================================================
--- branches/11/channels/chan_sip.c (original)
+++ branches/11/channels/chan_sip.c Sun Feb 8 20:44:24 2015
@@ -7044,7 +7044,7 @@
}
/* Send a hangup */
- if (ast_channel_state(oldowner) == AST_STATE_UP) {
+ if (ast_channel_state(oldowner) == AST_STATE_UP || p->invitereplaces) {
transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
}
@@ -8591,6 +8591,7 @@
make_our_tag(p);
p->ocseq = INITIAL_CSEQ;
p->allowed_methods = UINT_MAX;
+ p->invitereplaces = 0;
if (sip_methods[intended_method].need_rtp) {
p->maxcallbitrate = default_maxcallbitrate;
@@ -24917,6 +24918,8 @@
struct ast_channel *replacecall = p->refer->refer_call->owner; /* The channel we're about to take over */
struct ast_channel *targetcall; /* The bridge to the take-over target */
+ p->refer->refer_call->invitereplaces = 1;
+
/* Check if we're in ring state */
if (ast_channel_state(replacecall) == AST_STATE_RING)
earlyreplace = 1;
@@ -25025,6 +25028,11 @@
ast_channel_hangupcause_set(c, AST_CAUSE_SWITCH_CONGESTION);
ast_channel_unlock(c);
}
+
+ /* Clear SIP_DEFER_BYE_ON_TRANSFER after the masq to avoid delay hanging up replaced channel */
+ sip_pvt_lock(p);
+ ast_clear_flag(&p->refer->refer_call->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
+ sip_pvt_unlock(p);
/* c and c's tech pvt must be unlocked at this point for ast_hangup */
ast_hangup(c);
Modified: branches/11/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/sip/include/sip.h?view=diff&rev=431620&r1=431619&r2=431620
==============================================================================
--- branches/11/channels/sip/include/sip.h (original)
+++ branches/11/channels/sip/include/sip.h Sun Feb 8 20:44:24 2015
@@ -1100,6 +1100,7 @@
*/
unsigned short req_secure_signaling:1;/*!< Whether we are required to have secure signaling or not */
unsigned short natdetected:1; /*!< Whether we detected a NAT when processing the Via */
+ unsigned short invitereplaces:1; /*!< Whether we are doing an Invite: Replaces */
int timer_t1; /*!< SIP timer T1, ms rtt */
int timer_b; /*!< SIP timer B, ms */
unsigned int sipoptions; /*!< Supported SIP options on the other end */
More information about the asterisk-commits
mailing list