[svn-commits] qwell: branch qwell/ari_channel_variables r393350 - in /team/qwell/ari_channe...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 1 14:30:00 CDT 2013


Author: qwell
Date: Mon Jul  1 14:29:53 2013
New Revision: 393350

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393350
Log:
ARI: Implement channel hold/unhold.

This puts the channel on hold (rather than queueing a frame from the channel).

(closes issue ASTERISK-21619)

Review: https://reviewboard.asterisk.org/r/2647/
........

Merged revisions 393332 from http://svn.asterisk.org/svn/asterisk/trunk

Modified:
    team/qwell/ari_channel_variables/   (props changed)
    team/qwell/ari_channel_variables/include/asterisk/stasis_app.h
    team/qwell/ari_channel_variables/res/stasis/control.c
    team/qwell/ari_channel_variables/res/stasis_http/resource_channels.c

Propchange: team/qwell/ari_channel_variables/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jul  1 14:29:53 2013
@@ -1,1 +1,1 @@
-/trunk:1-393329
+/trunk:1-393348

Modified: team/qwell/ari_channel_variables/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_variables/include/asterisk/stasis_app.h?view=diff&rev=393350&r1=393349&r2=393350
==============================================================================
--- team/qwell/ari_channel_variables/include/asterisk/stasis_app.h (original)
+++ team/qwell/ari_channel_variables/include/asterisk/stasis_app.h Mon Jul  1 14:29:53 2013
@@ -193,6 +193,18 @@
 int stasis_app_control_set_channel_var(struct stasis_app_control *control, const char *variable, const char *value);
 
 /*!
+ * \brief Place the channel associated with the control on hold.
+ * \param control Control for \c res_stasis.
+ */
+void stasis_app_control_hold(struct stasis_app_control *control);
+
+/*!
+ * \brief Remove the channel associated with the control from hold.
+ * \param control Control for \c res_stasis.
+ */
+void stasis_app_control_unhold(struct stasis_app_control *control);
+
+/*!
  * \brief Returns the most recent snapshot for the associated channel.
  *
  * The returned pointer is AO2 managed, so ao2_cleanup() when you're done.

Modified: team/qwell/ari_channel_variables/res/stasis/control.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_variables/res/stasis/control.c?view=diff&rev=393350&r1=393349&r2=393350
==============================================================================
--- team/qwell/ari_channel_variables/res/stasis/control.c (original)
+++ team/qwell/ari_channel_variables/res/stasis/control.c Mon Jul  1 14:29:53 2013
@@ -233,6 +233,32 @@
 	return pbx_builtin_setvar_helper(control->channel, variable, value);
 }
 
+static void *app_control_hold(struct stasis_app_control *control,
+	struct ast_channel *chan, void *data)
+{
+	ast_indicate(control->channel, AST_CONTROL_HOLD);
+
+	return NULL;
+}
+
+void stasis_app_control_hold(struct stasis_app_control *control)
+{
+	stasis_app_send_command_async(control, app_control_hold, NULL);
+}
+
+static void *app_control_unhold(struct stasis_app_control *control,
+	struct ast_channel *chan, void *data)
+{
+	ast_indicate(control->channel, AST_CONTROL_UNHOLD);
+
+	return NULL;
+}
+
+void stasis_app_control_unhold(struct stasis_app_control *control)
+{
+	stasis_app_send_command_async(control, app_control_unhold, NULL);
+}
+
 struct ast_channel_snapshot *stasis_app_control_get_snapshot(
 	const struct stasis_app_control *control)
 {

Modified: team/qwell/ari_channel_variables/res/stasis_http/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_variables/res/stasis_http/resource_channels.c?view=diff&rev=393350&r1=393349&r2=393350
==============================================================================
--- team/qwell/ari_channel_variables/res/stasis_http/resource_channels.c (original)
+++ team/qwell/ari_channel_variables/res/stasis_http/resource_channels.c Mon Jul  1 14:29:53 2013
@@ -150,11 +150,32 @@
 }
 void stasis_http_hold_channel(struct ast_variable *headers, struct ast_hold_channel_args *args, struct stasis_http_response *response)
 {
-	ast_log(LOG_ERROR, "TODO: stasis_http_hold_channel\n");
-}
+	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_hold(control);
+
+	stasis_http_response_no_content(response);
+}
+
 void stasis_http_unhold_channel(struct ast_variable *headers, struct ast_unhold_channel_args *args, struct stasis_http_response *response)
 {
-	ast_log(LOG_ERROR, "TODO: stasis_http_unhold_channel\n");
+	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_unhold(control);
+
+	stasis_http_response_no_content(response);
 }
 
 void stasis_http_play_on_channel(struct ast_variable *headers,




More information about the svn-commits mailing list