83 const char *var_format;
84 const char *var_monitor;
85 const char *var_prefix;
90 var_format =
"TOUCH_MIXMONITOR_FORMAT";
91 var_monitor =
"TOUCH_MIXMONITOR";
92 var_prefix =
"TOUCH_MIXMONITOR_PREFIX";
93 var_beep =
"TOUCH_MIXMONITOR_BEEP";
106 ast_verb(4,
"AutoMixMonitor used to stop recording call.\n");
129 char *touch_filename, mix_options[32] =
"b";
140 &touch_monitor, &touch_monitor_prefix, &touch_monitor_beep);
141 switch (set_touch_res) {
146 &touch_monitor_prefix, &touch_monitor_beep);
156 len = strlen(touch_monitor) + 50;
158 snprintf(touch_filename,
len,
"%s-%ld-%s.%s",
159 S_OR(touch_monitor_prefix,
"auto"),
162 S_OR(touch_format,
"wav"));
164 char *caller_chan_id;
171 len = strlen(caller_chan_id) + strlen(peer_chan_id) + 50;
173 snprintf(touch_filename,
len,
"%s-%ld-%s-%s.%s",
174 S_OR(touch_monitor_prefix,
"auto"),
178 S_OR(touch_format,
"wav"));
181 for (x = 0; x < strlen(touch_filename); x++) {
182 if (touch_filename[x] ==
'/') {
183 touch_filename[x] =
'-';
187 ast_verb(4,
"AutoMixMonitor used to record call. Filename: %s\n", touch_filename);
190 unsigned int interval = 15;
191 if (sscanf(touch_monitor_beep,
"%30u", &interval) != 1) {
192 ast_log(
LOG_WARNING,
"Invalid interval '%s' for periodic beep. Using default of %u\n",
193 touch_monitor_beep, interval);
198 ast_log(
LOG_WARNING,
"Interval '%s' too small for periodic beep. Using minimum of %u\n",
199 touch_monitor_beep, interval);
201 snprintf(mix_options,
sizeof(mix_options),
"bB(%d)", interval);
205 ast_verb(4,
"AutoMixMonitor feature was tried by '%s' but MixMonitor failed to start.\n",
231 const char *stop_message;
232 const char *start_message;
248 ast_verb(4,
"Cannot start AutoMixMonitor for %s - cannot determine peer in bridge.\n",
250 if (features_cfg && !
ast_strlen_zero(features_cfg->recordingfailsound)) {
258 "TOUCH_MIXMONITOR_MESSAGE_START");
261 "TOUCH_MIXMONITOR_MESSAGE_STOP");
276 if (!is_monitoring) {
280 ast_verb(4,
"AutoMixMonitor already recording call.\n");
287 ast_verb(4,
"AutoMixMonitor already stopped on call.\n");
static const char *const mixmonitor_spy_type
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
int ast_channel_audiohook_count_by_source(struct ast_channel *chan, const char *source, enum ast_audiohook_type type)
Find out how many audiohooks from a certain source exist on a given channel, regardless of status.
Periodic beeps into the audio of a call.
#define ast_bridge_unlock(bridge)
Unlock the bridge.
struct ast_channel * ast_bridge_peer_nolock(struct ast_bridge *bridge, struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
static int feature_hangup(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
Internal built in feature for hangup.
static void set_touch_variable(enum set_touch_variables_res *res, struct ast_channel *chan, const char *var_name, char **touch)
static void start_automixmonitor(struct ast_bridge_channel *bridge_channel, struct ast_channel *peer_chan, struct ast_features_general_config *features_cfg, const char *start_message)
static int feature_automixmonitor(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
@ SET_TOUCH_ALLOC_FAILURE
static void stop_automixmonitor(struct ast_bridge_channel *bridge_channel, struct ast_channel *peer_chan, struct ast_features_general_config *features_cfg, const char *stop_message)
static int load_module(void)
static enum set_touch_variables_res set_touch_variables(struct ast_channel *chan, char **touch_format, char **touch_monitor, char **touch_monitor_prefix, char **touch_monitor_beep)
static int unload_module(void)
void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel)
Lock the bridge associated with the bridge channel.
@ BRIDGE_CHANNEL_STATE_END
int ast_bridge_channel_queue_playfile(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class)
Queue a bridge action play file frame onto the bridge channel.
int ast_bridge_channel_write_playfile(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class)
Write a bridge action play file frame into the bridge.
void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state, int cause)
Set bridge channel state to leave bridge (if not leaving already).
int ast_bridge_features_unregister(enum ast_bridge_builtin_feature feature)
Unregister a handler for a built in feature.
@ AST_BRIDGE_BUILTIN_AUTOMIXMON
@ AST_BRIDGE_BUILTIN_HANGUP
ast_bridge_features_monitor
int ast_bridge_features_register(enum ast_bridge_builtin_feature feature, ast_bridge_hook_callback callback, const char *dtmf)
Register a handler for a built in feature.
Internal Asterisk hangup causes.
#define AST_CAUSE_NORMAL_CLEARING
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
#define ast_channel_lock(chan)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
#define ast_channel_cleanup(c)
Cleanup a channel reference.
#define ast_channel_unlock(chan)
Generic File Format Support. Should be included by clients of the file handling routines....
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
struct ast_features_general_config * ast_get_chan_features_general_config(struct ast_channel *chan)
Get the general configuration options for a channel.
Asterisk internal frame definitions.
#define ast_verb(level,...)
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
loadable MixMonitor functionality
int ast_stop_mixmonitor(struct ast_channel *chan, const char *mixmon_id)
Stop a mixmonitor on a channel with the given parameters.
int ast_start_mixmonitor(struct ast_channel *chan, const char *filename, const char *options)
Start a mixmonitor on a channel with the given parameters.
Asterisk module definitions.
#define ast_module_shutdown_ref(mod)
Prevent unload of the module before shutdown.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
Core PBX routines and definitions.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Structure that contains information regarding a channel in a bridge.
struct ast_bridge * bridge
Bridge this channel is participating in.
struct ast_channel * chan
enum ast_bridge_features_monitor start_stop
Main Channel structure associated with a channel.
General features configuration items.
const ast_string_field recordingfailsound
const ast_string_field courtesytone
struct ast_party_id id
Caller party ID.
struct ast_party_number number
Subscriber phone number.
unsigned char valid
TRUE if the number information is valid/present.
char * str
Subscriber phone number (Malloced)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.