diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-09 05:30:05 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-09 05:30:05 +0000 |
commit | 43d78c44a2de39f9eae6a9a657d5dc8f58d9b8c2 (patch) | |
tree | 3e12957cc92251da5dc2bc29dd3624a41cfe9920 /apps/app_festival.c | |
parent | 27c56453795daeb69cbcb093569dfca532bbb3ee (diff) |
Bug 6787 - Allow escaping of newline characters for invoking non-Festival TTS systems
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@25829 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_festival.c')
-rw-r--r-- | apps/app_festival.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/app_festival.c b/apps/app_festival.c index 223aca571..cb38d42fd 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -305,6 +305,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata) 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 @@ static int festival_exec(struct ast_channel *chan, void *vdata) } 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))) { |