mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
ARI: Add support for suppressing media streams.
Also convert res_mutestream to use the core feature behind this. (closes issue ASTERISK-21618) Review: https://reviewboard.asterisk.org/r/2652/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394715 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -35,6 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/bridging.h"
|
||||
#include "asterisk/bridging_basic.h"
|
||||
#include "asterisk/bridging_features.h"
|
||||
#include "asterisk/frame.h"
|
||||
#include "asterisk/pbx.h"
|
||||
|
||||
struct stasis_app_control {
|
||||
@@ -207,6 +208,65 @@ int stasis_app_control_continue(struct stasis_app_control *control, const char *
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct stasis_app_control_mute_data {
|
||||
enum ast_frame_type frametype;
|
||||
unsigned int 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);
|
||||
SCOPED_CHANNELLOCK(lockvar, chan);
|
||||
|
||||
ast_channel_suppress(control->channel, mute_data->direction, mute_data->frametype);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int stasis_app_control_mute(struct stasis_app_control *control, unsigned int direction, enum ast_frame_type 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);
|
||||
SCOPED_CHANNELLOCK(lockvar, chan);
|
||||
|
||||
ast_channel_unsuppress(control->channel, mute_data->direction, mute_data->frametype);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int stasis_app_control_unmute(struct stasis_app_control *control, unsigned int direction, enum ast_frame_type 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;
|
||||
}
|
||||
|
||||
char *stasis_app_control_get_channel_var(struct stasis_app_control *control, const char *variable)
|
||||
{
|
||||
RAII_VAR(struct ast_str *, tmp, ast_str_create(32), ast_free);
|
||||
|
Reference in New Issue
Block a user