From: Jeff Peeler Date: Tue, 18 May 2010 18:54:58 +0000 (+0000) Subject: Modify directory name reading to be interrupted with operator or pound escape. X-Git-Tag: 1.4.33-rc1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a168f6578b919d2cebfbe92708a3e999ebc59f1;p=thirdparty%2Fasterisk.git Modify directory name reading to be interrupted with operator or pound escape. In the case of accidentally entering the wrong first three letters for the reading, users could be very frustrated if the name listing is very long. This allows interrupting the reading by pressing 0 or #. 0 will attempt to execute a configured operator (o) extension and # will exit and proceed in the dialplan. ABE-2200 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@263769 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_directory.c b/apps/app_directory.c index 23d2b4d626..440b3f704d 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -329,6 +329,14 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context, if (res < 0) /* User hungup, so jump out now */ break; + if (res == '0') { + if (!ast_goto_if_exists(chan, dialcontext, "o", 1) || + (!ast_strlen_zero(chan->macrocontext) && + !ast_goto_if_exists(chan, chan->macrocontext, "o", 1))) { + /* return 1 to indicate goto has been performed */ + return '1'; + } + } if (res == '1') { /* Name selected */ if (fromappvm) { /* We still want to set the exten though */ @@ -346,6 +354,8 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context, } if (res == '*') /* Skip to next match in list */ break; + if (res == '#') + break; /* Not '1', or '*', so decrement number of tries */ res = 0; @@ -516,6 +526,9 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, struct lastuserchoice = res; res = 0; break; + case '#': + lastuserchoice = res; + return 0; default: break; } @@ -645,6 +658,8 @@ static int directory_exec(struct ast_channel *chan, void *data) dirintro = ast_variable_retrieve(cfg, "general", "directoryintro"); if (ast_strlen_zero(dirintro)) dirintro = last ? "dir-intro" : "dir-intro-fn"; + /* the above prompts probably should be modified to include 0 for dialing operator + and # for exiting (continues in dialplan) */ if (chan->_state != AST_STATE_UP) res = ast_answer(chan);