diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-11 20:11:01 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-11 20:11:01 +0000 |
commit | 40e1ad1a2f57659ad12348d34905a535dc8cbb1b (patch) | |
tree | 3b89cad084b77d13eb4af9cd68bc3fabdef139e6 | |
parent | 8132623b6569840ac5200c010cde0a7abedc7f78 (diff) |
handle call time limit properly when warning is requested _after_ call would hae already ended (issue #6356)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@19301 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | apps/app_dial.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c index 5ec606062..c323480b2 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1,7 +1,7 @@ /* * Asterisk -- An open source telephony toolkit. * - * Copyright (C) 1999 - 2005, Digium, Inc. + * Copyright (C) 1999 - 2006, Digium, Inc. * * Mark Spencer <markster@digium.com> * @@ -827,6 +827,21 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags if (!timelimit) { timelimit = play_to_caller = play_to_callee = play_warning = warning_freq = 0; warning_sound = NULL; + } else if (play_warning > timelimit) { + /* If the first warning is requested _after_ the entire call would end, + and no warning frequency is requested, then turn off the warning. If + a warning frequency is requested, reduce the 'first warning' time by + that frequency until it falls within the call's total time limit. + */ + + if (!warning_freq) { + play_warning = 0; + } else { + while (play_warning > timelimit) + play_warning -= warning_freq; + if (play_warning < 1) + play_warning = warning_freq = 0; + } } var = pbx_builtin_getvar_helper(chan,"LIMIT_PLAYAUDIO_CALLER"); |