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
This commit is contained in:
Jonathan Rose
2013-11-14 20:32:45 +00:00
parent 67b650543c
commit ad0e70ba83
3 changed files with 108 additions and 16 deletions

View File

@@ -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) {