Index: app.c =================================================================== --- app.c (revision 42297) +++ app.c (working copy) @@ -108,23 +108,39 @@ "ludicrous time" (essentially never times out) */ int ast_app_getdata(struct ast_channel *c, char *prompt, char *s, int maxlen, int timeout) { - int res,to,fto; + int res = 0,to,fto; + char *front = NULL, *filename = NULL; /* XXX Merge with full version? XXX */ if (maxlen) s[0] = '\0'; if (prompt) { - res = ast_streamfile(c, prompt, c->language); - if (res < 0) - return res; + filename = ast_strdupa(prompt); + while((front = strsep(&filename, "&"))) { + res = ast_streamfile(c, front, c->language); + if (!res) { + if (ast_strlen_zero(filename)) { + /* set timeouts for the last prompt */ + fto = c->pbx ? c->pbx->rtimeout * 1000 : 6000; + to = c->pbx ? c->pbx->dtimeout * 1000 : 2000; + + if (timeout > 0) + fto = to = timeout; + if (timeout < 0) + fto = to = 1000000000; + } else { + /* there is more than one prompt, so + get rid of the long timeout between + prompts, and make it 50ms */ + fto = 50; + to = c->pbx ? c->pbx->dtimeout * 1000 : 2000; + } + res = ast_readstring(c, s, maxlen, to, fto, "#"); + if (!ast_strlen_zero(s)) { + return res; + } + } + } } - fto = c->pbx ? c->pbx->rtimeout * 1000 : 6000; - to = c->pbx ? c->pbx->dtimeout * 1000 : 2000; - - if (timeout > 0) - fto = to = timeout; - if (timeout < 0) - fto = to = 1000000000; - res = ast_readstring(c, s, maxlen, to, fto, "#"); return res; } Index: apps/app_read.c =================================================================== --- apps/app_read.c (revision 42297) +++ apps/app_read.c (working copy) @@ -49,10 +49,10 @@ static char *synopsis = "Read a variable"; static char *descrip = -" Read(variable[|filename][|maxdigits][|option][|attempts][|timeout])\n\n" +" Read(variable[|filename[&filename2...]][|maxdigits][|option][|attempts][|timeout])\n\n" "Reads a #-terminated string of digits a certain number of times from the\n" "user in to the given variable.\n" -" filename -- file to play before reading digits.\n" +" filename -- file(s) to play before reading digits.\n" " maxdigits -- maximum acceptable number of digits. Stops reading after\n" " maxdigits have been entered (without requiring the user to\n" " press the '#' key).\n" @@ -75,7 +75,7 @@ { int res = 0; struct localuser *u; - char tmp[256]; + char tmp[256] = ""; char *timeout = NULL; char *varname = NULL; char *filename = NULL;