summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2014-03-12 19:06:52 +0000
committerRichard Mudgett <rmudgett@digium.com>2014-03-12 19:06:52 +0000
commitf627a0aca050b5502f811710402ec52bb3681e11 (patch)
tree30738900688e7ff8ab7cee293ed947af6dd93404 /main/channel.c
parentde3dc17cc54c105c0671327dfab8d085d134054e (diff)
res_musiconhold.c: Generate MOH start/stop events whenever the MOH stream is started/stopped.
* Made res_musiconhold.c always post the MusicOnHoldStart/MusicOnHoldStop events when it actually starts/stops the music streams. This allows the events to always happen when MOH starts/stops. The event posting code was moved to the MOH alloc/release routines. * Made channel_do_masquerade() stop any MOH on the original channel before masquerading so the original channel will get a stop event with correct information. * Cleaned up a couple odd codings in moh_files_alloc() and moh_alloc() dealing with the music state variable. (issue ASTERISK-23311) Reported by: Benjamin Keith Ford Review: https://reviewboard.asterisk.org/r/3306/ ........ Merged revisions 410493 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410494 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/main/channel.c b/main/channel.c
index 0252bd8b7..6145e3505 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -6404,6 +6404,10 @@ static void channel_do_masquerade(struct ast_channel *original, struct ast_chann
ao2_unlink(channels, clonechan);
moh_is_playing = ast_test_flag(ast_channel_flags(original), AST_FLAG_MOH);
+ if (moh_is_playing) {
+ /* Stop MOH on the old original channel. */
+ ast_moh_stop(original);
+ }
/*
* Stop any visible indication on the original channel so we can
@@ -6704,9 +6708,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 was playing on the original channel then it needs to be
+ * maintained on the channel that is replacing it.
+ */
if (moh_is_playing) {
+ /* Start MOH on the new original channel. */
ast_moh_start(original, NULL, NULL);
}