[asterisk-commits] qwell: branch qwell/ari_channel_mute r393440 - /team/qwell/ari_channel_mute/r...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 2 11:24:21 CDT 2013
Author: qwell
Date: Tue Jul 2 11:24:19 2013
New Revision: 393440
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393440
Log:
Make mute/unmute async.
Modified:
team/qwell/ari_channel_mute/res/stasis/control.c
Modified: team/qwell/ari_channel_mute/res/stasis/control.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_mute/res/stasis/control.c?view=diff&rev=393440&r1=393439&r2=393440
==============================================================================
--- team/qwell/ari_channel_mute/res/stasis/control.c (original)
+++ team/qwell/ari_channel_mute/res/stasis/control.c Tue Jul 2 11:24:19 2013
@@ -207,14 +207,61 @@
return 0;
}
+struct stasis_app_control_mute_data {
+ int frametype;
+ enum ast_mute_direction direction;
+};
+
+static void *app_control_mute(struct stasis_app_control *control,
+ struct ast_channel *chan, void *data)
+{
+ RAII_VAR(struct stasis_app_control_mute_data *, mute_data, data, ast_free);
+
+ ast_channel_mute(control->channel, mute_data->direction, mute_data->frametype);
+
+ return NULL;
+}
+
int stasis_app_control_mute(struct stasis_app_control *control, enum ast_mute_direction direction, int frametype)
{
- return ast_channel_mute(control->channel, direction, frametype);
+ struct stasis_app_control_mute_data *mute_data;
+
+ if (!(mute_data = ast_calloc(1, sizeof(*mute_data)))) {
+ return -1;
+ }
+
+ mute_data->direction = direction;
+ mute_data->frametype = frametype;
+
+ stasis_app_send_command_async(control, app_control_mute, mute_data);
+
+ return 0;
+}
+
+static void *app_control_unmute(struct stasis_app_control *control,
+ struct ast_channel *chan, void *data)
+{
+ RAII_VAR(struct stasis_app_control_mute_data *, mute_data, data, ast_free);
+
+ ast_channel_unmute(control->channel, mute_data->direction, mute_data->frametype);
+
+ return NULL;
}
int stasis_app_control_unmute(struct stasis_app_control *control, enum ast_mute_direction direction, int frametype)
{
- return ast_channel_unmute(control->channel, direction, frametype);
+ struct stasis_app_control_mute_data *mute_data;
+
+ if (!(mute_data = ast_calloc(1, sizeof(*mute_data)))) {
+ return -1;
+ }
+
+ mute_data->direction = direction;
+ mute_data->frametype = frametype;
+
+ stasis_app_send_command_async(control, app_control_unmute, mute_data);
+
+ return 0;
}
static void *app_control_hold(struct stasis_app_control *control,
More information about the asterisk-commits
mailing list