From: Jenkins2 Date: Wed, 11 Apr 2018 12:03:19 +0000 (-0500) Subject: Merge "res_pjsip_refer/chan_sip: Fix INVITE with replaces transfer to ConfBridge... X-Git-Tag: 13.21.0-rc1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0edc4ade930424db0aa758db688b5eadc80de612;p=thirdparty%2Fasterisk.git Merge "res_pjsip_refer/chan_sip: Fix INVITE with replaces transfer to ConfBridge" into 13 --- 0edc4ade930424db0aa758db688b5eadc80de612 diff --cc channels/chan_sip.c index 702d666572,b096c33a3d..4e65c7b89a --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@@ -25671,17 -25670,8 +25671,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);