[asterisk-commits] trunk r25829 - /trunk/apps/app_festival.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon May 8 22:30:06 MST 2006
Author: tilghman
Date: Tue May 9 00:30:05 2006
New Revision: 25829
URL: http://svn.digium.com/view/asterisk?rev=25829&view=rev
Log:
Bug 6787 - Allow escaping of newline characters for invoking non-Festival TTS systems
Modified:
trunk/apps/app_festival.c
Modified: trunk/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_festival.c?rev=25829&r1=25828&r2=25829&view=diff
==============================================================================
--- trunk/apps/app_festival.c (original)
+++ trunk/apps/app_festival.c Tue May 9 00:30:05 2006
@@ -305,6 +305,7 @@
char *data;
char *intstr;
struct ast_config *cfg;
+ char *newfestivalcommand;
if (ast_strlen_zero(vdata)) {
ast_log(LOG_WARNING, "festival requires an argument (text)\n");
@@ -337,6 +338,22 @@
}
if (!(festivalcommand = ast_variable_retrieve(cfg, "general", "festivalcommand"))) {
festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n";
+ } else { /* This else parses the festivalcommand that we're sent from the config file for \n's, etc */
+ int i, j;
+ newfestivalcommand = alloca(strlen(festivalcommand) + 1);
+
+ for (i = 0, j = 0; i < strlen(festivalcommand); i++) {
+ if (festivalcommand[i] == '\\' && festivalcommand[i + 1] == 'n') {
+ newfestivalcommand[j++] = '\n';
+ i++;
+ } else if (festivalcommand[i] == '\\') {
+ newfestivalcommand[j++] = festivalcommand[i + 1];
+ i++;
+ } else
+ newfestivalcommand[j++] = festivalcommand[i];
+ }
+ newfestivalcommand[j] = '\0';
+ festivalcommand = newfestivalcommand;
}
if (!(data = ast_strdupa(vdata))) {
More information about the asterisk-commits
mailing list