mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-08 19:08:14 +00:00
Minor cleanups and error handling for app_dial #6935 (casper)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@19253 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -808,6 +808,11 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
|
|
||||||
if (ast_test_flag(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
|
if (ast_test_flag(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
|
||||||
calldurationlimit = atoi(opt_args[OPT_ARG_DURATION_STOP]);
|
calldurationlimit = atoi(opt_args[OPT_ARG_DURATION_STOP]);
|
||||||
|
if (!calldurationlimit) {
|
||||||
|
ast_log(LOG_WARNING, "Dial does not accept S(%s), hanging up.\n", opt_args[OPT_ARG_DURATION_STOP]);
|
||||||
|
LOCAL_USER_REMOVE(u);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %d seconds.\n", calldurationlimit);
|
ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %d seconds.\n", calldurationlimit);
|
||||||
}
|
}
|
||||||
@@ -833,8 +838,9 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
warning_freq = atol(warnfreq_str);
|
warning_freq = atol(warnfreq_str);
|
||||||
|
|
||||||
if (!timelimit) {
|
if (!timelimit) {
|
||||||
timelimit = play_to_caller = play_to_callee = play_warning = warning_freq = 0;
|
ast_log(LOG_WARNING, "Dial does not accept L(%s), hanging up.\n", limit_str);
|
||||||
warning_sound = NULL;
|
LOCAL_USER_REMOVE(u);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var = pbx_builtin_getvar_helper(chan,"LIMIT_PLAYAUDIO_CALLER");
|
var = pbx_builtin_getvar_helper(chan,"LIMIT_PLAYAUDIO_CALLER");
|
||||||
@@ -847,30 +853,32 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
play_to_caller = 1;
|
play_to_caller = 1;
|
||||||
|
|
||||||
var = pbx_builtin_getvar_helper(chan,"LIMIT_WARNING_FILE");
|
var = pbx_builtin_getvar_helper(chan,"LIMIT_WARNING_FILE");
|
||||||
warning_sound = var ? var : "timeleft";
|
warning_sound = (!ast_strlen_zero(var)) ? var : "timeleft";
|
||||||
|
|
||||||
var = pbx_builtin_getvar_helper(chan,"LIMIT_TIMEOUT_FILE");
|
var = pbx_builtin_getvar_helper(chan,"LIMIT_TIMEOUT_FILE");
|
||||||
end_sound = var ? var : NULL;
|
end_sound = (!ast_strlen_zero(var)) ? var : NULL;
|
||||||
|
|
||||||
var = pbx_builtin_getvar_helper(chan,"LIMIT_CONNECT_FILE");
|
var = pbx_builtin_getvar_helper(chan,"LIMIT_CONNECT_FILE");
|
||||||
start_sound = var ? var : NULL;
|
start_sound = (!ast_strlen_zero(var)) ? var : NULL;
|
||||||
|
|
||||||
/* undo effect of S(x) in case they are both used */
|
/* undo effect of S(x) in case they are both used */
|
||||||
calldurationlimit = 0;
|
calldurationlimit = 0;
|
||||||
/* more efficient do it like S(x) does since no advanced opts*/
|
/* more efficient to do it like S(x) does since no advanced opts */
|
||||||
if (!play_warning && !start_sound && !end_sound && timelimit) {
|
if (!play_warning && !start_sound && !end_sound && timelimit) {
|
||||||
calldurationlimit = timelimit / 1000;
|
calldurationlimit = timelimit / 1000;
|
||||||
|
if (option_verbose > 2)
|
||||||
|
ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %d seconds.\n", calldurationlimit);
|
||||||
timelimit = play_to_caller = play_to_callee = play_warning = warning_freq = 0;
|
timelimit = play_to_caller = play_to_callee = play_warning = warning_freq = 0;
|
||||||
} else if (option_verbose > 2) {
|
} else if (option_verbose > 2) {
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "Limit Data for this call:\n");
|
ast_verbose(VERBOSE_PREFIX_3 "Limit Data for this call:\n");
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "- timelimit = %ld\n", timelimit);
|
ast_verbose(VERBOSE_PREFIX_4 "timelimit = %ld\n", timelimit);
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "- play_warning = %ld\n", play_warning);
|
ast_verbose(VERBOSE_PREFIX_4 "play_warning = %ld\n", play_warning);
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "- play_to_caller= %s\n", play_to_caller ? "yes" : "no");
|
ast_verbose(VERBOSE_PREFIX_4 "play_to_caller = %s\n", play_to_caller ? "yes" : "no");
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "- play_to_callee= %s\n", play_to_callee ? "yes" : "no");
|
ast_verbose(VERBOSE_PREFIX_4 "play_to_callee = %s\n", play_to_callee ? "yes" : "no");
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "- warning_freq = %ld\n", warning_freq);
|
ast_verbose(VERBOSE_PREFIX_4 "warning_freq = %ld\n", warning_freq);
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "- start_sound = %s\n", start_sound ? start_sound : "UNDEF");
|
ast_verbose(VERBOSE_PREFIX_4 "start_sound = %s\n", start_sound);
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "- warning_sound = %s\n", warning_sound ? warning_sound : "UNDEF");
|
ast_verbose(VERBOSE_PREFIX_4 "warning_sound = %s\n", warning_sound);
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "- end_sound = %s\n", end_sound ? end_sound : "UNDEF");
|
ast_verbose(VERBOSE_PREFIX_4 "end_sound = %s\n", end_sound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user