提交 f12ab59e authored 作者: Anthony Minessale's avatar Anthony Minessale

omit file_string:// prefix if input begins with ~

上级 07a71592
...@@ -125,7 +125,9 @@ SWITCH_STANDARD_API(say_string_function) ...@@ -125,7 +125,9 @@ SWITCH_STANDARD_API(say_string_function)
char *lbuf = NULL, *string = NULL; char *lbuf = NULL, *string = NULL;
int err = 1, par = 0; int err = 1, par = 0;
char *p, *ext = "wav"; char *p, *ext = "wav";
char *tosay = NULL;
int strip = 0;
if (cmd) { if (cmd) {
lbuf = strdup(cmd); lbuf = strdup(cmd);
} }
...@@ -142,17 +144,25 @@ SWITCH_STANDARD_API(say_string_function) ...@@ -142,17 +144,25 @@ SWITCH_STANDARD_API(say_string_function)
*p++ = '\0'; *p++ = '\0';
ext = p; ext = p;
} }
tosay = (argc == 5) ? argv[4] : argv[5];
if (*tosay == '~') {
tosay++;
strip++;
}
switch_ivr_say_string(session, switch_ivr_say_string(session,
argv[1], argv[1],
ext, ext,
(argc == 5) ? argv[4] : argv[5], tosay,
argv[0], argv[0],
argv[2], argv[2],
argv[3], argv[3],
(argc == 6) ? argv[4] : NULL , (argc == 6) ? argv[4] : NULL ,
&string); &string);
if (string) { if (string) {
stream->write_function(stream, "%s", string); stream->write_function(stream, "%s", strip ? string + 14 : string);
free(string); free(string);
err = 0; err = 0;
} }
...@@ -161,7 +171,7 @@ SWITCH_STANDARD_API(say_string_function) ...@@ -161,7 +171,7 @@ SWITCH_STANDARD_API(say_string_function)
if (err) { if (err) {
stream->write_function(stream, "-ERR Usage: %s\n", SAY_STRING_SYNTAX); stream->write_function(stream, "-ERR Usage: %s\n", SAY_STRING_SYNTAX);
} }
free(lbuf); free(lbuf);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论