From: Joshua Colp Date: Tue, 2 Dec 2014 12:21:34 +0000 (+0000) Subject: res_pjsip_refer: Fix issue where native bridge may not occur upon completion of a... X-Git-Tag: 14.0.0-beta1~1426 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c1aaa7da524eb4305d8f8c3d8762f38fcf17919;p=thirdparty%2Fasterisk.git res_pjsip_refer: Fix issue where native bridge may not occur upon completion of a transfer. There are two methods within res_pjsip_refer for keeping track of the state of a transfer. The first is a framehook which looks at frames passing by to determine the state. The second subscribes to know when the channel joins a bridge. In the case when the channel joins the bridge the framehook is *NOT* removed and this prevents the native RTP bridging technology from getting used. This change gets the channel and if it still exists remove the framehook. Review: https://reviewboard.asterisk.org/r/4218/ ........ Merged revisions 428760 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 428761 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428762 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c index 7b8c537619..1cbbbc0b2e 100644 --- a/res/res_pjsip_refer.c +++ b/res/res_pjsip_refer.c @@ -149,6 +149,7 @@ static void refer_progress_bridge(void *data, struct stasis_subscription *sub, struct refer_progress *progress = data; struct ast_bridge_blob *enter_blob; struct refer_progress_notification *notification; + struct ast_channel *chan; if (stasis_subscription_final_message(sub, message)) { ao2_ref(progress, -1); @@ -180,6 +181,20 @@ static void refer_progress_bridge(void *data, struct stasis_subscription *sub, } progress->bridge_sub = stasis_unsubscribe(progress->bridge_sub); } + + chan = ast_channel_get_by_name(progress->transferee); + if (!chan) { + /* The channel is already gone */ + return; + } + + ast_channel_lock(chan); + ast_debug(3, "Detaching REFER progress monitoring hook from '%s' as it has joined a bridge\n", + ast_channel_name(chan)); + ast_framehook_detach(chan, progress->framehook); + ast_channel_unlock(chan); + + ast_channel_unref(chan); } /*! \brief Progress monitoring frame hook - examines frames to determine state of transfer */