From d025bba965381549a5411cf008b0a519a8a1937f Mon Sep 17 00:00:00 2001 From: kharwell Date: Fri, 21 Feb 2014 15:44:55 +0000 Subject: [PATCH] channel.c: MOH is not working for transferee after attended transfer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated the code to check to see if MOH is playing on the transferor and if so then start it on the channel that replaces it during a masquerade. Example scenario of the problem: Alice calls Bob and then Bob begins the attended transfer process into a queue. Upon going on hold Alice hears music and so does Bob once he is in the queue. Bob then transfers Alice into the queue and then music for Alice stops even though she should be hearing it since has now replaced Bob in the queue. The problem that was occurring is that once the channel was masqueraded the app (queues, confbridge, etc...) had no way of knowing that the channel had just been swapped out thus it did not start music for the present channel. Credit to Olle Johansson for pointing me in the right direction on this issue. (closes issue ASTERISK-19499) Reported by: Timo Teräs Review: https://reviewboard.asterisk.org/r/3226/ ........ Merged revisions 408642 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 408643 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: http://svn.digium.com/svn/asterisk/branches/12@408644 f38db490-d61c-443f-a65b-d21fe96a405b --- main/channel.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main/channel.c b/main/channel.c index a9f0fbb..da4f794 100644 --- a/main/channel.c +++ b/main/channel.c @@ -6406,6 +6406,7 @@ static void channel_do_masquerade(struct ast_channel *original, struct ast_chann unsigned int clone_disablestatecache; int visible_indication; int clone_hold_state; + int moh_is_playing; struct ast_frame *current; const struct ast_channel_tech *t; void *t_pvt; @@ -6452,6 +6453,8 @@ static void channel_do_masquerade(struct ast_channel *original, struct ast_chann ao2_unlink(channels, original); ao2_unlink(channels, clonechan); + moh_is_playing = ast_test_flag(ast_channel_flags(original), AST_FLAG_MOH); + /* * Stop any visible indication on the original channel so we can * transfer it to the clonechan taking the original's place. @@ -6753,6 +6756,12 @@ static void channel_do_masquerade(struct ast_channel *original, struct ast_chann } } + /* if moh is playing on the original channel then it needs to be + maintained on the channel that is replacing it. */ + if (moh_is_playing) { + ast_moh_start(original, NULL, NULL); + } + ast_channel_lock(original); /* Signal any blocker */ -- 1.9.0