[asterisk-commits] file: branch 1.4 r69558 - /branches/1.4/apps/app_speech_utils.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 15 14:23:46 CDT 2007


Author: file
Date: Fri Jun 15 14:23:45 2007
New Revision: 69558

URL: http://svn.digium.com/view/asterisk?view=rev&rev=69558
Log:
Merged revisions 69127 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r69127 | file | 2007-06-13 14:12:48 -0400 (Wed, 13 Jun 2007) | 2 lines

Return group counting to previous behavior where you could only have one group per category. (issue #9711 reported by irroot)

........

Modified:
    branches/1.4/apps/app_speech_utils.c

Modified: branches/1.4/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_speech_utils.c?view=diff&rev=69558&r1=69557&r2=69558
==============================================================================
--- branches/1.4/apps/app_speech_utils.c (original)
+++ branches/1.4/apps/app_speech_utils.c Fri Jun 15 14:23:45 2007
@@ -543,7 +543,7 @@
 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 @@
         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);
 
@@ -588,6 +589,10 @@
 		} else
 			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) {
@@ -724,6 +729,9 @@
 					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:




More information about the asterisk-commits mailing list