Index: pbx.c =================================================================== RCS file: /usr/cvsroot/asterisk/pbx.c,v retrieving revision 1.167 diff -u -r1.167 pbx.c --- pbx.c 1 Nov 2004 02:23:27 -0000 1.167 +++ pbx.c 17 Nov 2004 23:30:17 -0000 @@ -414,10 +414,14 @@ { "WaitExten", pbx_builtin_waitexten, "Waits for some time", - " Wait([seconds]): Waits for the user to enter a new extension for the \n" - "specified number of seconds, then returns 0. Seconds can be passed with\n" - "fractions of a seconds (eg: 1.5 = 1.5 seconds) or if unspecified the\n" + " WaitExten([seconds][c]): Waits for the user to enter a new extension for\n" + "the specified number of seconds, then returns 0. Seconds can be passed\n" + "with fractions of a seconds (eg: 1.5 = 1.5 seconds) or if unspecified the\n" "default extension timeout will be used.\n" + "\n" + " The optional 'c' argument appended directly to, or instead of the seconds\n" + "argument causes WaitExten to continue on to priority n+1 in the current\n" + "context as opposed to jumping to the 't' extension [the default behavior].\n" }, }; @@ -4767,21 +4771,39 @@ { int ms; int res; + char* wait; + char* option; + int option_continue = 0; + double delay = 0; + + if (data && !ast_strlen_zero(data)) { + if (!(wait = ast_strdupa(data))) { + ast_log(LOG_WARNING, "Unable to duplicate string :(\n"); + } else { + delay = strtod(wait, &option); + + if (strlen(option) && !strncmp(option, "c", 1)) { + option_continue++; + option++; + } + } + } + /* Wait for "n" seconds */ - if (data && atof((char *)data)) - ms = atof((char *)data) * 1000; + if (data && delay) + ms = delay * 1000; else if (chan->pbx) ms = chan->pbx->rtimeout * 1000; else ms = 10000; res = ast_waitfordigit(chan, ms); if (!res) { - if (ast_exists_extension(chan, chan->context, "t", 1, chan->cid.cid_num)) { + if (!option_continue && ast_exists_extension(chan, chan->context, "t", 1, chan->cid.cid_num)) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Timeout on %s\n", chan->name); strncpy(chan->exten, "t", sizeof(chan->exten)); chan->priority = 0; - } else { + } else if (!option_continue) { ast_log(LOG_WARNING, "Timeout but no rule 't' in context '%s'\n", chan->context); res = -1; }