summaryrefslogtreecommitdiff
path: root/res/ari
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-11-21 15:56:34 +0000
committerDavid M. Lee <dlee@digium.com>2013-11-21 15:56:34 +0000
commitd1ad4a95f8967cc407d828af258c772aa69ab6e3 (patch)
tree9dfcb189d4df7d2de758537463a09224722a5519 /res/ari
parent71612fb0077b3d22895342fdd12beae4862b53ca (diff)
ari: Add silence generator controls
This patch adds the ability to start a silence generator on a channel via ARI. This generator will play silence on the channel (avoiding audio timeouts on the peer) until it is stopped, or some other media operation is started (like playing media, starting music on hold, etc.). (closes issue ASTERISK-22514) Review: https://reviewboard.asterisk.org/r/3019/ ........ Merged revisions 402926 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402928 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/ari')
-rw-r--r--res/ari/resource_channels.c32
-rw-r--r--res/ari/resource_channels.h30
2 files changed, 61 insertions, 1 deletions
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 2ddfae1c5..dc0058fa5 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -321,6 +321,38 @@ void ast_ari_channels_stop_moh(struct ast_variable *headers,
ast_ari_response_no_content(response);
}
+void ast_ari_channels_start_silence(struct ast_variable *headers,
+ struct ast_ari_channels_start_silence_args *args,
+ struct ast_ari_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_silence_start(control);
+ ast_ari_response_no_content(response);
+}
+
+void ast_ari_channels_stop_silence(struct ast_variable *headers,
+ struct ast_ari_channels_stop_silence_args *args,
+ struct ast_ari_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_silence_stop(control);
+ ast_ari_response_no_content(response);
+}
+
void ast_ari_channels_play(struct ast_variable *headers,
struct ast_ari_channels_play_args *args,
struct ast_ari_response *response)
diff --git a/res/ari/resource_channels.h b/res/ari/resource_channels.h
index 6106b0061..a9ac72e39 100644
--- a/res/ari/resource_channels.h
+++ b/res/ari/resource_channels.h
@@ -254,7 +254,7 @@ struct ast_ari_channels_start_moh_args {
/*!
* \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.
+ * Using media operations such as /play 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
@@ -274,6 +274,34 @@ struct ast_ari_channels_stop_moh_args {
* \param[out] response HTTP response
*/
void ast_ari_channels_stop_moh(struct ast_variable *headers, struct ast_ari_channels_stop_moh_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_channels_start_silence() */
+struct ast_ari_channels_start_silence_args {
+ /*! \brief Channel's id */
+ const char *channel_id;
+};
+/*!
+ * \brief Play silence to a channel.
+ *
+ * Using media operations such as /play on a channel playing silence in this manner will suspend silence without resuming automatically.
+ *
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void ast_ari_channels_start_silence(struct ast_variable *headers, struct ast_ari_channels_start_silence_args *args, struct ast_ari_response *response);
+/*! \brief Argument struct for ast_ari_channels_stop_silence() */
+struct ast_ari_channels_stop_silence_args {
+ /*! \brief Channel's id */
+ const char *channel_id;
+};
+/*!
+ * \brief Stop playing silence to a channel.
+ *
+ * \param headers HTTP headers
+ * \param args Swagger parameters
+ * \param[out] response HTTP response
+ */
+void ast_ari_channels_stop_silence(struct ast_variable *headers, struct ast_ari_channels_stop_silence_args *args, struct ast_ari_response *response);
/*! \brief Argument struct for ast_ari_channels_play() */
struct ast_ari_channels_play_args {
/*! \brief Channel's id */