mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@410493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user