diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-15 19:25:11 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-15 19:25:11 +0000 |
commit | 0a0ae2c3648b5afd5ebbde4dbddc753908b3c033 (patch) | |
tree | 85b36bf0190dd1bb7a43478d1c69c656328ce6a5 /apps/app_speech_utils.c | |
parent | 93b415ac6733bffbdb081118d58062c06b5c6ab4 (diff) |
Merged revisions 69558 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r69558 | file | 2007-06-15 15:23:45 -0400 (Fri, 15 Jun 2007) | 2 lines
Add support for setting the maximum length of acceptable DTMF in SpeechBackground.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@69559 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_speech_utils.c')
-rw-r--r-- | apps/app_speech_utils.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c index c18fd6fb8..bf90f55c7 100644 --- a/apps/app_speech_utils.c +++ b/apps/app_speech_utils.c @@ -543,7 +543,7 @@ static int speech_streamfile(struct ast_channel *chan, const char *filename, con static int speech_background(struct ast_channel *chan, void *data) { unsigned int timeout = 0; - int res = 0, done = 0, argc = 0, started = 0, quieted = 0; + int res = 0, done = 0, argc = 0, started = 0, quieted = 0, max_dtmf_len = 0; struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); struct ast_frame *f = NULL; @@ -552,6 +552,7 @@ static int speech_background(struct ast_channel *chan, void *data) time_t start, current; struct ast_datastore *datastore = NULL; char *argv[2], *args = NULL, *filename_tmp = NULL, *filename = NULL, tmp[2] = ""; + const char *tmp2 = NULL; args = ast_strdupa(data); @@ -589,6 +590,10 @@ static int speech_background(struct ast_channel *chan, void *data) timeout = 0; } + /* See if the maximum DTMF length variable is set... we use a variable in case they want to carry it through their entire dialplan */ + if ((tmp2 = pbx_builtin_getvar_helper(chan, "SPEECH_DTMF_MAXLEN")) && !ast_strlen_zero(tmp2)) + max_dtmf_len = atoi(tmp2); + /* 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); @@ -724,6 +729,9 @@ static int speech_background(struct ast_channel *chan, void *data) time(&start); snprintf(tmp, sizeof(tmp), "%c", f->subclass); strncat(dtmf, tmp, sizeof(dtmf)); + /* If the maximum length of the DTMF has been reached, stop now */ + if (max_dtmf_len && strlen(dtmf) == max_dtmf_len) + done = 1; } break; case AST_FRAME_CONTROL: |