]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add ability to specify no timeout. This means as soon as the prompt is done playing...
authorJoshua Colp <jcolp@digium.com>
Mon, 26 Mar 2007 19:34:14 +0000 (19:34 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 26 Mar 2007 19:34:14 +0000 (19:34 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@59223 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_speech_utils.c

index 73fe3ce13d6a991f31e00469e0d86541b8fa89ba..92b3dcd45919f01e20fed69b02dbe58ea2ccac12 100644 (file)
@@ -544,8 +544,11 @@ static int speech_background(struct ast_channel *chan, void *data)
         if (argc > 0) {
                 /* Yay sound file */
                 filename_tmp = ast_strdupa(argv[0]);
-                if (argv[1] != NULL)
-                        timeout = atoi(argv[1]);
+               if (!ast_strlen_zero(argv[1])) {
+                       if ((timeout = atoi(argv[1])) == 0)
+                               timeout = -1;
+               } else
+                       timeout = 0;
         }
 
         /* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */
@@ -611,7 +614,13 @@ static int speech_background(struct ast_channel *chan, void *data)
                         /* If audio playback has stopped do a check for timeout purposes */
                         if (chan->streamid == -1 && chan->timingfunc == NULL)
                                 ast_stopstream(chan);
-                        if (!quieted && chan->stream == NULL && timeout > 0 && started == 0 && !filename_tmp) {
+                        if (!quieted && chan->stream == NULL && timeout && started == 0 && !filename_tmp) {
+                               if (timeout == -1) {
+                                       done = 1;
+                                       if (f)
+                                               ast_frfree(f);
+                                       break;
+                               }
                                time(&start);
                                started = 1;
                         }