]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Modify directory name reading to be interrupted with operator or pound escape.
authorJeff Peeler <jpeeler@digium.com>
Tue, 18 May 2010 18:54:58 +0000 (18:54 +0000)
committerJeff Peeler <jpeeler@digium.com>
Tue, 18 May 2010 18:54:58 +0000 (18:54 +0000)
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

apps/app_directory.c

index 23d2b4d626e9740d8c0e9d06247ef0242afeb62f..440b3f704dab29cfaa063a9828ea85fc81804302 100644 (file)
@@ -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);