diff options
author | Jonathan Rose <jrose@digium.com> | 2013-07-19 19:40:27 +0000 |
---|---|---|
committer | Jonathan Rose <jrose@digium.com> | 2013-07-19 19:40:27 +0000 |
commit | a6329a3acf0109d5b364476d212cd0aee4c20dfb (patch) | |
tree | b0bac64d5dbe5ceb2ea2d32227c5b79349b38228 /res/stasis | |
parent | 17c546173fe1f24749af4643f19b40be180803de (diff) |
ARI: MOH start and stop for a channel
(issue ASTERISK-21974)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2680/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394810 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/stasis')
-rw-r--r-- | res/stasis/control.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/res/stasis/control.c b/res/stasis/control.c index 9d8abe0cc..50da8b9f0 100644 --- a/res/stasis/control.c +++ b/res/stasis/control.c @@ -37,6 +37,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/bridging_features.h" #include "asterisk/frame.h" #include "asterisk/pbx.h" +#include "asterisk/musiconhold.h" struct stasis_app_control { /*! Queue of commands to dispatch on the channel */ @@ -325,6 +326,40 @@ void stasis_app_control_unhold(struct stasis_app_control *control) stasis_app_send_command_async(control, app_control_unhold, NULL); } +static void *app_control_moh_start(struct stasis_app_control *control, + struct ast_channel *chan, void *data) +{ + char *moh_class = data; + + ast_moh_start(chan, moh_class, NULL); + + ast_free(moh_class); + return NULL; +} + +void stasis_app_control_moh_start(struct stasis_app_control *control, const char *moh_class) +{ + char *data = NULL; + + if (!ast_strlen_zero(moh_class)) { + data = ast_strdup(moh_class); + } + + stasis_app_send_command_async(control, app_control_moh_start, data); +} + +static void *app_control_moh_stop(struct stasis_app_control *control, + struct ast_channel *chan, void *data) +{ + ast_moh_stop(chan); + return NULL; +} + +void stasis_app_control_moh_stop(struct stasis_app_control *control) +{ + stasis_app_send_command_async(control, app_control_moh_stop, NULL); +} + struct ast_channel_snapshot *stasis_app_control_get_snapshot( const struct stasis_app_control *control) { |