summaryrefslogtreecommitdiff
path: root/res/stasis_http
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2013-07-19 19:40:27 +0000
committerJonathan Rose <jrose@digium.com>2013-07-19 19:40:27 +0000
commita6329a3acf0109d5b364476d212cd0aee4c20dfb (patch)
treeb0bac64d5dbe5ceb2ea2d32227c5b79349b38228 /res/stasis_http
parent17c546173fe1f24749af4643f19b40be180803de (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_http')
-rw-r--r--res/stasis_http/resource_channels.c28
-rw-r--r--res/stasis_http/resource_channels.h30
2 files changed, 58 insertions, 0 deletions
diff --git a/res/stasis_http/resource_channels.c b/res/stasis_http/resource_channels.c
index c25917bb6..38befbdc1 100644
--- a/res/stasis_http/resource_channels.c
+++ b/res/stasis_http/resource_channels.c
@@ -229,6 +229,34 @@ void stasis_http_unhold_channel(struct ast_variable *headers, struct ast_unhold_
stasis_http_response_no_content(response);
}
+void stasis_http_moh_start_channel(struct ast_variable *headers, struct ast_moh_start_channel_args *args, struct stasis_http_response *response)
+{
+ RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
+
+ control = find_control(response, args->channel_id);
+ if (control == NULL) {
+ /* Response filled in by find_control */
+ return;
+ }
+
+ stasis_app_control_moh_start(control, args->moh_class);
+ stasis_http_response_no_content(response);
+}
+
+void stasis_http_moh_stop_channel(struct ast_variable *headers, struct ast_moh_stop_channel_args *args, struct stasis_http_response *response)
+{
+ RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
+
+ control = find_control(response, args->channel_id);
+ if (control == NULL) {
+ /* Response filled in by find_control */
+ return;
+ }
+
+ stasis_app_control_moh_stop(control);
+ stasis_http_response_no_content(response);
+}
+
void stasis_http_play_on_channel(struct ast_variable *headers,
struct ast_play_on_channel_args *args,
struct stasis_http_response *response)
diff --git a/res/stasis_http/resource_channels.h b/res/stasis_http/resource_channels.h
index 999e16954..c0baedef3 100644
--- a/res/stasis_http/resource_channels.h
+++ b/res/stasis_http/resource_channels.h
@@ -212,6 +212,36 @@ struct ast_unhold_channel_args {
* \param[out] response HTTP response
*/
void stasis_http_unhold_channel(struct ast_variable *headers, struct ast_unhold_channel_args *args, struct stasis_http_response *response);
+/*! \brief Argument struct for stasis_http_moh_start_channel() */
+struct ast_moh_start_channel_args {
+ /*! \brief Channel's id */
+ const char *channel_id;
+ /*! \brief Music on hold class to use */
+ const char *moh_class;
+};
+/*!
+ * \brief Play music on hold to a channel.
+ *
+ * Using media operations such as playOnChannel on a channel playing MOH in this manner will suspend MOH without resuming automatically. If continuing music on hold is desired, the stasis application must reinitiate music on hold.
+ *
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void stasis_http_moh_start_channel(struct ast_variable *headers, struct ast_moh_start_channel_args *args, struct stasis_http_response *response);
+/*! \brief Argument struct for stasis_http_moh_stop_channel() */
+struct ast_moh_stop_channel_args {
+ /*! \brief Channel's id */
+ const char *channel_id;
+};
+/*!
+ * \brief Stop playing music on hold to a channel.
+ *
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void stasis_http_moh_stop_channel(struct ast_variable *headers, struct ast_moh_stop_channel_args *args, struct stasis_http_response *response);
/*! \brief Argument struct for stasis_http_play_on_channel() */
struct ast_play_on_channel_args {
/*! \brief Channel's id */