diff options
author | Jonathan Rose <jrose@digium.com> | 2013-11-14 20:32:45 +0000 |
---|---|---|
committer | Jonathan Rose <jrose@digium.com> | 2013-11-14 20:32:45 +0000 |
commit | ad0e70ba83d3b7d08127b0a32b73d977dff0dac5 (patch) | |
tree | dabb0680926269a868e6bef07042c81c229111e9 /apps/app_sayunixtime.c | |
parent | 67b650543c3ea59418bf159323d7244c343f85f6 (diff) |
Say: If SAY_DTMF_INTERRUPT is set to an ast_true value, jump on DTMF
Similar to how background works, if a say application is called with
this variable set to 'true', 'yes', 'on', etc. then using DTMF while
the say action is in progress will result in the channel jumping to
that extension in the dialplan.
Review: https://reviewboard.asterisk.org/r/3011/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402819 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_sayunixtime.c')
-rw-r--r-- | apps/app_sayunixtime.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/app_sayunixtime.c b/apps/app_sayunixtime.c index 7d34ed9cd..3b4d2b51e 100644 --- a/apps/app_sayunixtime.c +++ b/apps/app_sayunixtime.c @@ -59,7 +59,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") <parameter name="options" required="false"> <optionlist> <option name="j"> - <para>Allow the calling user to dial digits to jump to that extension.</para> + <para>Allow the calling user to dial digits to jump to that extension. + This option is automatically enabled if + <variable>SAY_DTMF_INTERRUPT</variable> is present on the channel and + set to 'true' (case insensitive)</para> </option> </optionlist> </parameter> @@ -129,6 +132,7 @@ static int sayunixtime_exec(struct ast_channel *chan, const char *data) const char * haltondigits = AST_DIGIT_NONE; struct ast_flags64 opts = { 0, }; char *opt_args[OPT_ARG_ARRAY_SIZE]; + const char *interrupt_string; if (!data) { return 0; @@ -146,6 +150,14 @@ static int sayunixtime_exec(struct ast_channel *chan, const char *data) } } + /* Check if 'SAY_DTMF_INTERRUPT' is true and apply the same behavior as the j flag. */ + ast_channel_lock(chan); + interrupt_string = pbx_builtin_getvar_helper(chan, "SAY_DTMF_INTERRUPT"); + if (ast_true(interrupt_string)) { + haltondigits = AST_DIGIT_ANY; + } + ast_channel_unlock(chan); + ast_get_time_t(ast_strlen_zero(args.timeval) ? NULL : args.timeval, &unixtime, time(NULL), NULL); if (ast_channel_state(chan) != AST_STATE_UP) { |