aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_speech_utils.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-25 22:16:10 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-25 22:16:10 +0000
commite0d21aafb11300240ff9156bbee8ae03323661bf (patch)
treeb8f337ace6eece1f2c33afd4f5031a2c477e07dd /apps/app_speech_utils.c
parent744eeaeb5703cd4cfa60382b835327ca935e827d (diff)
(closes issue #10303)
Reported by: jtodd Add SPEECH_DTMF_TERMINATOR variable so the user can specify the digit to terminate a DTMF string with. If none is specified then no terminator will be used. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@77176 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_speech_utils.c')
-rw-r--r--apps/app_speech_utils.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c
index 40b4616e8..c545db7cd 100644
--- a/apps/app_speech_utils.c
+++ b/apps/app_speech_utils.c
@@ -550,7 +550,7 @@ static int speech_background(struct ast_channel *chan, void *data)
char dtmf[AST_MAX_EXTENSION] = "";
time_t start, current;
struct ast_datastore *datastore = NULL;
- char *argv[2], *args = NULL, *filename_tmp = NULL, *filename = NULL, tmp[2] = "";
+ char *argv[2], *args = NULL, *filename_tmp = NULL, *filename = NULL, tmp[2] = "", dtmf_terminator = '#';
const char *tmp2 = NULL;
args = ast_strdupa(data);
@@ -593,6 +593,14 @@ static int speech_background(struct ast_channel *chan, void *data)
if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_MAXLEN")) && !ast_strlen_zero(tmp2))
max_dtmf_len = atoi(tmp2);
+ /* See if a terminator is specified */
+ if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_TERMINATOR"))) {
+ if (ast_strlen_zero(tmp2))
+ dtmf_terminator = '\0';
+ else
+ dtmf_terminator = tmp2[0];
+ }
+
/* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */
if (speech->state == AST_SPEECH_STATE_NOT_READY || speech->state == AST_SPEECH_STATE_DONE) {
ast_speech_change_state(speech, AST_SPEECH_STATE_NOT_READY);
@@ -714,7 +722,7 @@ static int speech_background(struct ast_channel *chan, void *data)
/* Free the frame we received */
switch (f->frametype) {
case AST_FRAME_DTMF:
- if (f->subclass == '#') {
+ if (dtmf_terminator != '\0' && f->subclass == dtmf_terminator) {
done = 1;
} else {
if (chan->stream != NULL) {