]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make variable to override what tts says for # and *
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 16 Oct 2007 18:49:56 +0000 (18:49 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 16 Oct 2007 18:49:56 +0000 (18:49 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5908 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_play_say.c

index 46e6e509cc4a50233051318be6c1f9ae3aef9087..485d4fa66a8f4298d315e2844103f39466243e34 100644 (file)
@@ -1202,7 +1202,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
        uint32_t rate = 0;
        int extra = 0;
        char *p, *tmp = NULL;
-
+       char *star, *pound;
+       switch_size_t starlen, poundlen;
+       
        channel = switch_core_session_get_channel(session);
        assert(channel != NULL);
 
@@ -1218,12 +1220,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
        len = sh->samples * 2;
        
        flags = 0;
-       //switch_sleep(200000);
+       
+       if (!(star = switch_channel_get_variable(channel, "star_replace"))) {
+               star = "star";
+       }
+       if (!(pound = switch_channel_get_variable(channel, "pound_replace"))) {
+               pound = "pound";
+       }
+       starlen = strlen(star);
+       poundlen = strlen(pound);
+
+
        for(p = text; p && *p; p++) {
                if (*p == '*') {
-                       extra += 4;
+                       extra += starlen;
                } else if (*p == '#') {
-                       extra += 5;
+                       extra += poundlen;
                }
        }
 
@@ -1231,24 +1243,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
                char *tp;
                switch_size_t mylen = strlen(text) + extra + 1;
                tmp = malloc(mylen);
+               memset(tmp, 0, mylen);
                tp = tmp;
                for (p = text; p && *p; p++) {
                        if (*p == '*') {
-                               *tp++ = 's';
-                               *tp++ = 't';
-                               *tp++ = 'a';
-                               *tp++ = 'r';
+                               strncat(tp, star, starlen);
+                               tp += starlen;
                        } else  if (*p == '#') {
-                               *tp++ = 'p';
-                               *tp++ = 'o';
-                               *tp++ = 'u';
-                               *tp++ = 'n';
-                               *tp++ = 'd';
+                               strncat(tp, pound, poundlen);
+                               tp += poundlen;
                        } else {
                                *tp++ = *p;
                        }
                }
-               *tp = '\0';
+               
                text = tmp;
        }