Merged revisions 77795 via svnmerge from
authorJason Parker <jparker@digium.com>
Mon, 30 Jul 2007 20:19:13 +0000 (20:19 +0000)
committerJason Parker <jparker@digium.com>
Mon, 30 Jul 2007 20:19:13 +0000 (20:19 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

(closes issue #10083)
........
r77795 | qwell | 2007-07-30 15:17:08 -0500 (Mon, 30 Jul 2007) | 6 lines

Applications like SayAlpha() should not hang up the channel if you
 request an "unknown" character such as a comma.
Instead, skip the character and move on.

Issue 10083, initial patch by jsmith, modified by me.

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77796 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/say.c

index 3ad8e73..9ed4817 100644 (file)
@@ -126,14 +126,16 @@ static int say_character_str_full(struct ast_channel *chan, const char *str, con
                        fnbuf[8] = ltr;
                        fn = fnbuf;
                }
                        fnbuf[8] = ltr;
                        fn = fnbuf;
                }
-               res = ast_streamfile(chan, fn, lang);
-               if (!res) {
-                       if ((audiofd  > -1) && (ctrlfd > -1))
-                               res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
-                       else
-                               res = ast_waitstream(chan, ints);
+               if (fn && ast_fileexists(fn, NULL, NULL) > 0) {
+                       res = ast_streamfile(chan, fn, lang);
+                       if (!res) {
+                               if ((audiofd  > -1) && (ctrlfd > -1))
+                                       res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
+                               else
+                                       res = ast_waitstream(chan, ints);
+                       }
+                       ast_stopstream(chan);
                }
                }
-               ast_stopstream(chan);
                num++;
        }
 
                num++;
        }
 
@@ -204,14 +206,16 @@ static int say_phonetic_str_full(struct ast_channel *chan, const char *str, cons
                        fnbuf[9] = ltr;
                        fn = fnbuf;
                }
                        fnbuf[9] = ltr;
                        fn = fnbuf;
                }
-               res = ast_streamfile(chan, fn, lang);
-               if (!res) {
-                       if ((audiofd  > -1) && (ctrlfd > -1))
-                               res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
-                       else
-                               res = ast_waitstream(chan, ints);
+               if (fn && ast_fileexists(fn, NULL, NULL) > 0) {
+                       res = ast_streamfile(chan, fn, lang);
+                       if (!res) {
+                               if ((audiofd  > -1) && (ctrlfd > -1))
+                                       res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
+                               else
+                                       res = ast_waitstream(chan, ints);
+                       }
+                       ast_stopstream(chan);
                }
                }
-               ast_stopstream(chan);
                num++;
        }
 
                num++;
        }
 
@@ -252,7 +256,7 @@ static int say_digit_str_full(struct ast_channel *chan, const char *str, const c
                        fn = fnbuf;
                        break;
                }
                        fn = fnbuf;
                        break;
                }
-               if (fn) {
+               if (fn && ast_fileexists(fn, NULL, NULL) > 0) {
                        res = ast_streamfile(chan, fn, lang);
                        if (!res) {
                                if ((audiofd  > -1) && (ctrlfd > -1))
                        res = ast_streamfile(chan, fn, lang);
                        if (!res) {
                                if ((audiofd  > -1) && (ctrlfd > -1))