Index: apps/app_readexten.c
===================================================================
--- apps/app_readexten.c (revision 378197)
+++ apps/app_readexten.c (working copy)
@@ -65,6 +65,10 @@
+
@@ -120,12 +124,14 @@
OPT_SKIP = (1 << 0),
OPT_INDICATION = (1 << 1),
OPT_NOANSWER = (1 << 2),
+ OPT_DELAYTIMEOUT = (1 << 3),
};
AST_APP_OPTIONS(readexten_app_options, {
AST_APP_OPTION('s', OPT_SKIP),
AST_APP_OPTION('i', OPT_INDICATION),
AST_APP_OPTION('n', OPT_NOANSWER),
+ AST_APP_OPTION('d', OPT_DELAYTIMEOUT),
});
static char *app = "ReadExten";
@@ -211,6 +217,7 @@
if (ts && ts->data[0]) {
res = ast_playtones_start(chan, 0, ts->data, 0);
+ ast_clear_flag(&flags, OPT_DELAYTIMEOUT);
} else if (arglist.filename) {
if (ast_test_flag(&flags, OPT_INDICATION) && ast_fileexists(arglist.filename, NULL, chan->language) <= 0) {
/*
@@ -220,6 +227,7 @@
* (but honestly, who would do something so silly?)
*/
res = ast_playtones_start(chan, 0, arglist.filename, 0);
+ ast_clear_flag(&flags, OPT_DELAYTIMEOUT);
} else {
res = ast_streamfile(chan, arglist.filename, chan->language);
}
@@ -227,7 +235,15 @@
for (x = 0; x < maxdigits; x++) {
ast_debug(3, "extension so far: '%s', timeout: %d\n", exten, timeout);
- res = ast_waitfordigit(chan, timeout);
+ if (ast_test_flag(&flags, OPT_DELAYTIMEOUT)) {
+ res = ast_waitstream(chan, AST_DIGIT_ANY);
+ ast_clear_flag(&flags, OPT_DELAYTIMEOUT);
+ if (res == 0) {
+ res = ast_waitfordigit(chan, timeout);
+ }
+ } else {
+ res = ast_waitfordigit(chan, timeout);
+ }
ast_playtones_stop(chan);
ast_stopstream(chan);