diff options
author | Alec L Davis <sivad.a@paradise.net.nz> | 2009-12-15 07:18:31 +0000 |
---|---|---|
committer | Alec L Davis <sivad.a@paradise.net.nz> | 2009-12-15 07:18:31 +0000 |
commit | 13c3260c92024904ce9aeccf6da8339ca65010bd (patch) | |
tree | e7371172c28610d13b57c4c7556333cf37a6e8d3 /apps | |
parent | 155931303bb56dfd27f1d5c804a7120b2c8bfcea (diff) |
Support option 'n', as applications like Playback, Background etc.
Suggested on asterisk-dev as trivial application change.
Reported by: alecdavis
Tested by: alecdavis
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@234976 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_directory.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c index 27ce632ae..2bc223910 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -88,6 +88,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") <para>Instead of reading each name sequentially and asking for confirmation, create a menu of up to 8 names.</para> </option> + <option name="n"> + <para>Read digits even if the channel is not answered.</para> + </option> <option name="p"> <para>Pause for n milliseconds after the digits are typed. This is helpful for people with cellphones, who are not holding the @@ -128,6 +131,7 @@ enum { OPT_LISTBYLASTNAME = (1 << 4), OPT_LISTBYEITHER = OPT_LISTBYFIRSTNAME | OPT_LISTBYLASTNAME, OPT_PAUSE = (1 << 5), + OPT_NOANSWER = (1 << 6), }; enum { @@ -156,6 +160,7 @@ AST_APP_OPTIONS(directory_app_options, { AST_APP_OPTION('e', OPT_SAYEXTENSION), AST_APP_OPTION('v', OPT_FROMVOICEMAIL), AST_APP_OPTION('m', OPT_SELECTFROMMENU), + AST_APP_OPTION('n', OPT_NOANSWER), }); static int compare(const char *text, const char *template) @@ -786,9 +791,12 @@ static int directory_exec(struct ast_channel *chan, const char *data) } digits[7] = digit + '0'; - if (chan->_state != AST_STATE_UP) - res = ast_answer(chan); - + if (chan->_state != AST_STATE_UP) { + if (!ast_test_flag(&flags, OPT_NOANSWER)) { + /* Otherwise answer unless we're supposed to read while on-hook */ + res = ast_answer(chan); + } + } for (;;) { if (!ast_strlen_zero(dirintro) && !res) { res = ast_stream_and_wait(chan, dirintro, AST_DIGIT_ANY); |