make variable to override what tts says for # and *

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5908 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-10-16 18:49:56 +00:00
parent 9488c2c813
commit 65d6e75371

View File

@ -1202,7 +1202,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
uint32_t rate = 0; uint32_t rate = 0;
int extra = 0; int extra = 0;
char *p, *tmp = NULL; char *p, *tmp = NULL;
char *star, *pound;
switch_size_t starlen, poundlen;
channel = switch_core_session_get_channel(session); channel = switch_core_session_get_channel(session);
assert(channel != NULL); assert(channel != NULL);
@ -1218,12 +1220,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
len = sh->samples * 2; len = sh->samples * 2;
flags = 0; 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++) { for(p = text; p && *p; p++) {
if (*p == '*') { if (*p == '*') {
extra += 4; extra += starlen;
} else if (*p == '#') { } 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; char *tp;
switch_size_t mylen = strlen(text) + extra + 1; switch_size_t mylen = strlen(text) + extra + 1;
tmp = malloc(mylen); tmp = malloc(mylen);
memset(tmp, 0, mylen);
tp = tmp; tp = tmp;
for (p = text; p && *p; p++) { for (p = text; p && *p; p++) {
if (*p == '*') { if (*p == '*') {
*tp++ = 's'; strncat(tp, star, starlen);
*tp++ = 't'; tp += starlen;
*tp++ = 'a';
*tp++ = 'r';
} else if (*p == '#') { } else if (*p == '#') {
*tp++ = 'p'; strncat(tp, pound, poundlen);
*tp++ = 'o'; tp += poundlen;
*tp++ = 'u';
*tp++ = 'n';
*tp++ = 'd';
} else { } else {
*tp++ = *p; *tp++ = *p;
} }
} }
*tp = '\0';
text = tmp; text = tmp;
} }