aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_directory.c
diff options
context:
space:
mode:
authoralecdavis <alecdavis@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-15 07:18:31 +0000
committeralecdavis <alecdavis@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-15 07:18:31 +0000
commit211684784d1ea9a4b89d0cd95774980bd3b3ef0b (patch)
treee7371172c28610d13b57c4c7556333cf37a6e8d3 /apps/app_directory.c
parent0a038fc6490b9088c02ce1803afc0e6187ef43ee (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: http://svn.digium.com/svn/asterisk/trunk@234976 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_directory.c')
-rw-r--r--apps/app_directory.c14
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);