Index: apps/app_read.c =================================================================== --- apps/app_read.c (revision 334902) +++ apps/app_read.c (working copy) @@ -77,6 +77,12 @@ + @@ -116,12 +122,14 @@ OPT_SKIP = (1 << 0), OPT_INDICATION = (1 << 1), OPT_NOANSWER = (1 << 2), + OPT_HASH = (1 <<3 ), }; AST_APP_OPTIONS(read_app_options, { AST_APP_OPTION('s', OPT_SKIP), AST_APP_OPTION('i', OPT_INDICATION), AST_APP_OPTION('n', OPT_NOANSWER), + AST_APP_OPTION('h', OPT_HASH), }); static char *app = "Read"; @@ -185,6 +194,11 @@ } else ast_verb(3, "Accepting a maximum of %d digits.\n", maxdigits); } + + if (ast_test_flag(&flags, OPT_HASH) && to==0 && maxdigits==255) { + ast_log(LOG_WARNING, "Read(): used option h without timeout and without maxdigits"); + } + if (ast_strlen_zero(arglist.variable)) { ast_log(LOG_WARNING, "Invalid! Usage: Read(variable[,filename][,maxdigits][,option][,attempts][,timeout])\n\n"); return 0; @@ -222,7 +236,7 @@ break; } tmp[x++] = res; - if (tmp[x-1] == '#') { + if (tmp[x-1] == '#' && !ast_test_flag(&flags, OPT_HASH)) { tmp[x-1] = '\0'; status = "OK"; break; @@ -233,8 +247,32 @@ } } else { res = ast_app_getdata(chan, arglist.filename, tmp, maxdigits, to); - if (res == AST_GETDATA_COMPLETE || res == AST_GETDATA_EMPTY_END_TERMINATED) + if (res == AST_GETDATA_COMPLETE || res == AST_GETDATA_EMPTY_END_TERMINATED) { + if (!to) + to = chan->pbx ? chan->pbx->rtimeoutms : 6000; status = "OK"; + x=strlen(tmp); + if (x= maxdigits) { + status = "OK"; + } + } + } else if (res == AST_GETDATA_TIMEOUT) status = "TIMEOUT"; else if (res == AST_GETDATA_INTERRUPTED)