38 #include <sys/types.h> 84 const char *var_format;
85 const char *var_monitor;
86 const char *var_prefix;
91 var_format =
"TOUCH_MIXMONITOR_FORMAT";
92 var_monitor =
"TOUCH_MIXMONITOR";
93 var_prefix =
"TOUCH_MIXMONITOR_PREFIX";
95 var_format =
"TOUCH_MONITOR_FORMAT";
96 var_monitor =
"TOUCH_MONITOR";
97 var_prefix =
"TOUCH_MONITOR_PREFIX";
108 ast_verb(4,
"AutoMonitor used to stop recording call.\n");
141 char *touch_filename;
151 &touch_monitor, &touch_monitor_prefix);
152 switch (set_touch_res) {
157 &touch_monitor_prefix);
167 len = strlen(touch_monitor) + 50;
169 snprintf(touch_filename, len,
"%s-%ld-%s",
170 S_OR(touch_monitor_prefix,
"auto"),
174 char *caller_chan_id;
181 len = strlen(caller_chan_id) + strlen(peer_chan_id) + 50;
183 snprintf(touch_filename, len,
"%s-%ld-%s-%s",
184 S_OR(touch_monitor_prefix,
"auto"),
190 for (x = 0; x < strlen(touch_filename); x++) {
191 if (touch_filename[x] ==
'/') {
192 touch_filename[x] =
'-';
196 ast_verb(4,
"AutoMonitor used to record call. Filename: %s\n", touch_filename);
199 ast_verb(4,
"AutoMonitor feature was tried by '%s' but monitor failed to start.\n",
222 const char *start_message;
223 const char *stop_message;
239 ast_verb(4,
"Cannot start AutoMonitor for %s - can not determine peer in bridge.\n",
241 if (features_cfg && !
ast_strlen_zero(features_cfg->recordingfailsound)) {
249 "TOUCH_MONITOR_MESSAGE_START");
252 "TOUCH_MONITOR_MESSAGE_STOP");
257 switch (start_stop) {
266 if (!is_monitoring) {
270 ast_verb(4,
"AutoMonitor already recording call.\n");
277 ast_verb(4,
"AutoMonitor already stopped on call.\n");
302 ast_verb(4,
"AutoMixMonitor used to stop recording call.\n");
325 char *touch_filename;
335 &touch_monitor, &touch_monitor_prefix);
336 switch (set_touch_res) {
341 &touch_monitor_prefix);
351 len = strlen(touch_monitor) + 50;
353 snprintf(touch_filename, len,
"%s-%ld-%s.%s",
354 S_OR(touch_monitor_prefix,
"auto"),
357 S_OR(touch_format,
"wav"));
359 char *caller_chan_id;
366 len = strlen(caller_chan_id) + strlen(peer_chan_id) + 50;
368 snprintf(touch_filename, len,
"%s-%ld-%s-%s.%s",
369 S_OR(touch_monitor_prefix,
"auto"),
373 S_OR(touch_format,
"wav"));
376 for (x = 0; x < strlen(touch_filename); x++) {
377 if (touch_filename[x] ==
'/') {
378 touch_filename[x] =
'-';
382 ast_verb(4,
"AutoMixMonitor used to record call. Filename: %s\n", touch_filename);
385 ast_verb(4,
"AutoMixMonitor feature was tried by '%s' but MixMonitor failed to start.\n",
411 const char *stop_message;
412 const char *start_message;
428 ast_verb(4,
"Cannot start AutoMixMonitor for %s - cannot determine peer in bridge.\n",
430 if (features_cfg && !
ast_strlen_zero(features_cfg->recordingfailsound)) {
438 "TOUCH_MIXMONITOR_MESSAGE_START");
441 "TOUCH_MIXMONITOR_MESSAGE_STOP");
447 switch (start_stop) {
456 if (!is_monitoring) {
460 ast_verb(4,
"AutoMixMonitor already recording call.\n");
467 ast_verb(4,
"AutoMixMonitor already stopped on call.\n");
528 .optional_modules =
"res_monitor",
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
char * str
Subscriber phone number (Malloced)
Asterisk main include file. File version handling, generic pbx functions.
enum ast_bridge_features_monitor start_stop
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)
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.
General features configuration items.
ast_bridge_features_monitor
int ast_start_mixmonitor(struct ast_channel *chan, const char *filename, const char *options)
Start a mixmonitor on a channel with the given parameters.
#define ast_strdup(str)
A wrapper for strdup()
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
static int load_module(void)
#define ast_verb(level,...)
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
struct ast_bridge * bridge
Bridge this channel is participating in.
#define ast_strlen_zero(foo)
int ast_bridge_features_unregister(enum ast_bridge_builtin_feature feature)
Unregister a handler for a built in feature.
static void set_touch_variable(enum set_touch_variables_res *res, struct ast_channel *chan, const char *var_name, char **touch)
const ast_string_field courtesytone
struct ast_party_id id
Caller party ID.
struct ast_features_general_config * ast_get_chan_features_general_config(struct ast_channel *chan)
Get the general configuration options for a channel.
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...
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
General Asterisk PBX channel definitions.
static const char *const mixmonitor_spy_type
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
static int feature_hangup(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
Internal built in feature for hangup.
#define AST_CAUSE_NORMAL_CLEARING
int AST_OPTIONAL_API_NAME() ast_monitor_start(struct ast_channel *chan, const char *format_spec, const char *fname_base, int need_lock, int stream_action, const char *beep_id)
Start monitoring a channel.
#define ast_channel_cleanup(c)
Cleanup a channel reference.
Asterisk internal frame definitions.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
#define ast_strdupa(s)
duplicate a string in memory from the stack
Core PBX routines and definitions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
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.
int ast_stop_mixmonitor(struct ast_channel *chan, const char *mixmon_id)
Stop a mixmonitor on a channel with the given parameters.
#define ast_module_shutdown_ref(mod)
Prevent unload of the module before shutdown.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
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.
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).
#define ast_channel_unlock(chan)
#define ast_bridge_unlock(bridge)
Unlock the bridge.
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)
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
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...
static enum set_touch_variables_res set_touch_variables(struct ast_channel *chan, int is_mixmonitor, char **touch_format, char **touch_monitor, char **touch_monitor_prefix)
static int feature_automixmonitor(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
const ast_string_field recordingfailsound
struct ast_channel * chan
Structure that contains information regarding a channel in a bridge.
void AST_OPTIONAL_API_NAME() ast_monitor_setjoinfiles(struct ast_channel *chan, int turnon)
void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel)
Lock the bridge associated with the bridge channel.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
const char * ast_channel_name(const struct ast_channel *chan)
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.
static void stop_automonitor(struct ast_bridge_channel *bridge_channel, struct ast_channel *peer_chan, struct ast_features_general_config *features_cfg, const char *stop_message)
Internal Asterisk hangup causes.
static int feature_automonitor(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
loadable MixMonitor functionality
static int unload_module(void)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
struct ast_channel_monitor * ast_channel_monitor(const struct ast_channel *chan)
enum ast_bridge_features_monitor start_stop
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
unsigned char valid
TRUE if the number information is valid/present.
static void start_automonitor(struct ast_bridge_channel *bridge_channel, struct ast_channel *peer_chan, struct ast_features_general_config *features_cfg, const char *start_message)
struct ast_party_number number
Subscriber phone number.