47 #include "asterisk/options.h"
139 ast_debug(2,
"Can't find any datastore to use. Bad. \n");
143 mute = datastore->
data;
169 ast_debug(2,
"Initializing new Mute Audiohook \n");
198 ast_debug(2,
"Initialized audiohook on channel %s\n", chan->
name);
223 mute = datastore->
data;
225 if (!strcasecmp(data,
"out")) {
227 ast_debug(1,
"%s channel - outbound \n",
ast_true(value) ?
"Muting" :
"Unmuting");
228 }
else if (!strcasecmp(data,
"in")) {
230 ast_debug(1,
"%s channel - inbound \n",
ast_true(value) ?
"Muting" :
"Unmuting");
231 }
else if (!strcasecmp(data,
"all")) {
259 char id_text[256] =
"";
280 snprintf(id_text,
sizeof(id_text),
"ActionID: %s\r\n",
id);
299 mute = datastore->
data;
302 if (!strcasecmp(direction,
"in")) {
304 }
else if (!strcasecmp(direction,
"out")) {
306 }
else if (!strcasecmp(direction,
"all")) {
322 "\r\n\r\n", id_text);
328 "Description: Mute an incoming or outbound audio stream in a channel.\n"
330 " Channel: <name> The channel you want to mute.\n"
331 " Direction: in | out |all The stream you want to mute.\n"
332 " State: on | off Whether to turn mute on or off.\n"
333 " ActionID: <id> Optional action ID for this AMI transaction.\n";
342 "Mute an audio stream", mandescr_mutestream);
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
void astman_append(struct mansession *s, const char *fmt,...)
Asterisk main include file. File version handling, generic pbx functions.
void ast_module_unref(struct ast_module *)
int ast_frame_clear(struct ast_frame *frame)
Clear all audio samples from an ast_frame. The frame must be AST_FRAME_VOICE and AST_FORMAT_SLINEAR.
static struct ast_datastore * initialize_mutehook(struct ast_channel *chan)
Initialize mute hook on channel, but don't activate it.
static int mute_callback(struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction)
The callback from the audiohook subsystem. We basically get a frame to have fun with.
#define ast_channel_unref(c)
Decrease channel reference count.
static int load_module(void)
int ast_audiohook_init(struct ast_audiohook *audiohook, enum ast_audiohook_type type, const char *source)
Initialize an audiohook structure.
Structure for a data store type.
Configuration File Parser.
int ast_audiohook_attach(struct ast_channel *chan, struct ast_audiohook *audiohook)
Attach audiohook to channel.
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
static void destroy_callback(void *data)
int ast_audiohook_destroy(struct ast_audiohook *audiohook)
Destroys an audiohook structure.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
const char * astman_get_header(const struct message *m, char *var)
Get header from mananger transaction.
ast_audiohook_manipulate_callback manipulate_callback
#define EVENT_FLAG_SYSTEM
static const char mandescr_mutestream[]
#define ast_debug(level,...)
Log a DEBUG message.
General Asterisk PBX channel definitions.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Data structure associated with a custom dialplan function.
Asterisk internal frame definitions.
int ast_manager_register2(const char *action, int authority, int(*func)(struct mansession *s, const struct message *m), const char *synopsis, const char *description)
Register a manager command with the manager interface.
static int mute_add_audiohook(struct ast_channel *chan, struct mute_information *mute, struct ast_datastore *datastore)
Add or activate mute audiohook on channel Assumes channel is locked.
Core PBX routines and definitions.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
const ast_string_field name
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
static struct ast_datastore_info mute_datastore
Static structure for datastore information.
struct ast_datastore * ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
#define ast_channel_unlock(chan)
Support for logging to various files, console and syslog Configuration in file logger.conf.
static int func_mute_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
Mute dialplan function.
Data structure associated with a single frame of data.
static int unload_module(void)
enum ast_audiohook_status status
enum ast_frame_type frametype
static struct ast_custom_function mute_function
#define ASTERISK_GPL_KEY
The text the key() function should return.
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
Asterisk module definitions.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_manager_unregister(char *action)
Unregister a registered manager command.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
static int manager_mutestream(struct mansession *s, const struct message *m)
struct ast_module * ast_module_ref(struct ast_module *)