Merge Tony's one touch record improvements (bug #3263)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4742 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Mark Spencer 21 years ago
parent 4fc6c2eb0d
commit 77dafbed41

@ -100,6 +100,10 @@ The queue() application uses the following variables:
${MONITOR_FILENAME} File for monitoring (recording) calls in queue ${MONITOR_FILENAME} File for monitoring (recording) calls in queue
${QUEUE_PRIO} Queue priority ${QUEUE_PRIO} Queue priority
The following variables can be set to change certian behaviour:
${TOUCH_MONITOR} The filename base to use with Touch Monitor (auto record)
There are two reference modes - reference by value and reference by name. There are two reference modes - reference by value and reference by name.
To refer to a variable with its name (as an argument to a function that To refer to a variable with its name (as an argument to a function that
requires a variable), just write the name. To refer to the variable's value, requires a variable), just write the name. To refer to the variable's value,

@ -365,24 +365,22 @@ int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int
static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense) static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
{ {
char *args; char *touch_monitor = NULL, *chan_id = NULL, *peer_id = NULL, *args = NULL;
if (option_verbose > 3) int x = 0;
ast_verbose(VERBOSE_PREFIX_3 "User hit '%s' to record call.\n", code); size_t len;
if (monitor_ok) {
if (!monitor_ok) {
ast_log(LOG_ERROR,"Cannot record the call. The monitor application is disabled.\n");
return -1;
}
if (!monitor_app) { if (!monitor_app) {
if (!(monitor_app = pbx_findapp("Monitor"))) { if (!(monitor_app = pbx_findapp("Monitor"))) {
monitor_ok=0; monitor_ok=0;
ast_log(LOG_ERROR,"Cannot record the call. The monitor application is disabled.\n");
return -1; return -1;
} }
} }
/* Copy to local variable just in case one of the channels goes away */
args = pbx_builtin_getvar_helper(chan, "TOUCH_MONITOR");
if (!args)
args = pbx_builtin_getvar_helper(peer, "TOUCH_MONITOR");
if (!args)
args = "WAV||m";
pbx_exec(peer, monitor_app, args, 1);
if (!ast_strlen_zero(courtesytone)) { if (!ast_strlen_zero(courtesytone)) {
if (ast_autoservice_start(peer)) if (ast_autoservice_start(peer))
return -1; return -1;
@ -396,9 +394,44 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
if (ast_autoservice_stop(peer)) if (ast_autoservice_stop(peer))
return -1; return -1;
} }
if (peer->monitor) {
if (option_verbose > 3)
ast_verbose(VERBOSE_PREFIX_3 "User hit '%s' to stop recording call.\n", code);
ast_monitor_stop(peer, 1);
return FEATURE_RETURN_SUCCESS;
}
if (chan && peer) {
touch_monitor = pbx_builtin_getvar_helper(chan, "TOUCH_MONITOR");
if (!touch_monitor)
touch_monitor = pbx_builtin_getvar_helper(peer, "TOUCH_MONITOR");
if (touch_monitor) {
len = strlen(touch_monitor) + 50;
args = alloca(len);
snprintf(args, len, "WAV|auto-%ld-%s|m", time(NULL), touch_monitor);
} else {
chan_id = ast_strdupa(chan->cid.cid_num ? chan->cid.cid_num : chan->name);
peer_id = ast_strdupa(peer->cid.cid_num ? peer->cid.cid_num : peer->name);
len = strlen(chan_id) + strlen(peer_id) + 50;
args = alloca(len);
snprintf(args, len, "WAV|auto-%ld-%s-%s|m", time(NULL), chan_id, peer_id);
}
for( x = 0; x < strlen(args); x++)
if (args[x] == '/')
args[x] = '-';
if (option_verbose > 3)
ast_verbose(VERBOSE_PREFIX_3 "User hit '%s' to record call. filename: %s\n", code, args);
pbx_exec(peer, monitor_app, args, 1);
return FEATURE_RETURN_SUCCESS; return FEATURE_RETURN_SUCCESS;
} }
ast_log(LOG_NOTICE,"Cannot record the call. One or both channels have gone away.\n");
return -1; return -1;
} }
@ -1372,20 +1405,16 @@ static int manager_parking_status( struct mansession *s, struct message *m )
} }
static int load_config(void)
int load_module(void)
{ {
int res; int start = 0, end = 0;
int start, end; struct ast_context *con = NULL;
struct ast_context *con; struct ast_config *cfg = NULL;
struct ast_config *cfg; struct ast_variable *var = NULL;
struct ast_variable *var;
transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT; transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT; featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
ast_cli_register(&showparked);
cfg = ast_load("features.conf"); cfg = ast_load("features.conf");
if (!cfg) { if (!cfg) {
cfg = ast_load("parking.conf"); cfg = ast_load("parking.conf");
@ -1445,15 +1474,29 @@ int load_module(void)
} }
ast_destroy(cfg); ast_destroy(cfg);
} }
con = ast_context_find(parking_con);
if (!con) { if (con)
con = ast_context_create(NULL,parking_con, registrar); ast_context_remove_extension2(con, ast_parking_ext(), 1, registrar);
if (!con) {
if (!(con = ast_context_find(parking_con))) {
if (!(con = ast_context_create(NULL, parking_con, registrar))) {
ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con); ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con);
return -1; return -1;
} }
} }
ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, NULL, parkcall, strdup(""),free, registrar); return ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, NULL, parkcall, strdup(""),free, registrar);
}
int reload(void) {
return load_config();
}
int load_module(void)
{
int res;
if ((res = load_config()))
return res;
ast_cli_register(&showparked);
ast_pthread_create(&parking_thread, NULL, do_parking_thread, NULL); ast_pthread_create(&parking_thread, NULL, do_parking_thread, NULL);
res = ast_register_application(parkedcall, park_exec, synopsis, descrip); res = ast_register_application(parkedcall, park_exec, synopsis, descrip);
if (!res) if (!res)

Loading…
Cancel
Save