mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 03:18:30 +00:00
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
This commit is contained in:
@@ -100,6 +100,10 @@ The queue() application uses the following variables:
|
||||
${MONITOR_FILENAME} File for monitoring (recording) calls in queue
|
||||
${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.
|
||||
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,
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
char *args;
|
||||
if (option_verbose > 3)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "User hit '%s' to record call.\n", code);
|
||||
if (monitor_ok) {
|
||||
char *touch_monitor = NULL, *chan_id = NULL, *peer_id = NULL, *args = NULL;
|
||||
int x = 0;
|
||||
size_t len;
|
||||
|
||||
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 = pbx_findapp("Monitor"))) {
|
||||
monitor_ok=0;
|
||||
ast_log(LOG_ERROR,"Cannot record the call. The monitor application is disabled.\n");
|
||||
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_autoservice_start(peer))
|
||||
return -1;
|
||||
@@ -396,9 +394,44 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
|
||||
if (ast_autoservice_stop(peer))
|
||||
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;
|
||||
}
|
||||
|
||||
ast_log(LOG_NOTICE,"Cannot record the call. One or both channels have gone away.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1372,20 +1405,16 @@ static int manager_parking_status( struct mansession *s, struct message *m )
|
||||
}
|
||||
|
||||
|
||||
|
||||
int load_module(void)
|
||||
static int load_config(void)
|
||||
{
|
||||
int res;
|
||||
int start, end;
|
||||
struct ast_context *con;
|
||||
struct ast_config *cfg;
|
||||
struct ast_variable *var;
|
||||
int start = 0, end = 0;
|
||||
struct ast_context *con = NULL;
|
||||
struct ast_config *cfg = NULL;
|
||||
struct ast_variable *var = NULL;
|
||||
|
||||
transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
|
||||
featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
|
||||
|
||||
ast_cli_register(&showparked);
|
||||
|
||||
cfg = ast_load("features.conf");
|
||||
if (!cfg) {
|
||||
cfg = ast_load("parking.conf");
|
||||
@@ -1445,15 +1474,29 @@ int load_module(void)
|
||||
}
|
||||
ast_destroy(cfg);
|
||||
}
|
||||
con = ast_context_find(parking_con);
|
||||
if (!con) {
|
||||
con = ast_context_create(NULL,parking_con, registrar);
|
||||
if (!con) {
|
||||
|
||||
if (con)
|
||||
ast_context_remove_extension2(con, ast_parking_ext(), 1, registrar);
|
||||
|
||||
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);
|
||||
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);
|
||||
res = ast_register_application(parkedcall, park_exec, synopsis, descrip);
|
||||
if (!res)
|
||||
|
||||
Reference in New Issue
Block a user