From: Jenkins2 Date: Wed, 11 Apr 2018 12:14:14 +0000 (-0500) Subject: Merge "res_pjsip_refer/chan_sip: Fix INVITE with replaces transfer to ConfBridge... X-Git-Tag: 15.4.0-rc1~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f02d86c9d7465a963c400cde736598b704ced75;p=thirdparty%2Fasterisk.git Merge "res_pjsip_refer/chan_sip: Fix INVITE with replaces transfer to ConfBridge" into 15 --- 7f02d86c9d7465a963c400cde736598b704ced75 diff --cc channels/chan_sip.c index 464a4fb8cc,23b1fb15d0..bfdc5d07f1 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@@ -25726,17 -25725,8 +25726,14 @@@ static int handle_invite_replaces(struc ast_raw_answer(c); - ast_channel_lock(replaces_chan); - bridge = ast_channel_get_bridge(replaces_chan); - ast_channel_unlock(replaces_chan); - + bridge = ast_bridge_transfer_acquire_bridge(replaces_chan); if (bridge) { + /* + * We have two refs of the channel. One is held in c and the other + * is notionally represented by p->owner. The impart is "stealing" + * the p->owner ref on success so the bridging system can have + * control of when the channel is hung up. + */ if (ast_bridge_impart(bridge, c, replaces_chan, NULL, AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) { ast_hangup(c);