aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-18 19:41:10 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-18 19:41:10 +0000
commit598b4be23ee0fa90fd4a780c1e729941b70a7e16 (patch)
tree4689e7bea6af4f3cb48f32f4e119263945a3bbd7
parent1682e083376ac3164d46c9a8e7e39e2051f72865 (diff)
Merged revisions 263807 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r263807 | jpeeler | 2010-05-18 14:27:34 -0500 (Tue, 18 May 2010) | 17 lines Merged revisions 263769 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r263769 | jpeeler | 2010-05-18 13:54:58 -0500 (Tue, 18 May 2010) | 10 lines 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: http://svn.digium.com/svn/asterisk/branches/1.6.2@263809 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_directory.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c
index d8a26a500..f33710abd 100644
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -239,6 +239,19 @@ static int compare(const char *text, const char *template)
return 0;
}
+static int goto_exten(struct ast_channel *chan, const char *dialcontext, char *ext)
+{
+ if (!ast_goto_if_exists(chan, dialcontext, ext, 1) ||
+ (!ast_strlen_zero(chan->macrocontext) &&
+ !ast_goto_if_exists(chan, chan->macrocontext, ext, 1))) {
+ return 0;
+ } else {
+ ast_log(LOG_WARNING, "Can't find extension '%s' in current context. "
+ "Not Exiting the Directory!\n", ext);
+ return -1;
+ }
+}
+
/* play name of mailbox owner.
* returns: -1 for bad or missing extension
* '1' for selected entry from directory
@@ -319,11 +332,17 @@ static int select_item_seq(struct ast_channel *chan, struct directory_item **ite
res = ast_waitfordigit(chan, 3000);
ast_stopstream(chan);
- if (res == '1') { /* Name selected */
+ if (res == '0') { /* operator selected */
+ goto_exten(chan, dialcontext, "o");
+ return '0';
+ } else if (res == '1') { /* Name selected */
return select_entry(chan, dialcontext, item, flags) ? -1 : 1;
} else if (res == '*') {
/* Skip to next match in list */
break;
+ } else if (res == '#') {
+ /* Exit reading, continue in dialplan */
+ return res;
}
if (res < 0)
@@ -652,19 +671,6 @@ static void sort_items(struct directory_item **sorted, int count)
} while (reordered);
}
-static int goto_exten(struct ast_channel *chan, const char *dialcontext, char *ext)
-{
- if (!ast_goto_if_exists(chan, dialcontext, ext, 1) ||
- (!ast_strlen_zero(chan->macrocontext) &&
- !ast_goto_if_exists(chan, chan->macrocontext, ext, 1))) {
- return 0;
- } else {
- ast_log(LOG_WARNING, "Can't find extension '%s' in current context. "
- "Not Exiting the Directory!\n", ext);
- return -1;
- }
-}
-
static int do_directory(struct ast_channel *chan, struct ast_config *vmcfg, struct ast_config *ucfg, char *context, char *dialcontext, char digit, int digits, struct ast_flags *flags, char *opts[])
{
/* Read in the first three digits.. "digit" is the first digit, already read */
@@ -778,6 +784,8 @@ static int directory_exec(struct ast_channel *chan, void *data)
dirintro = ast_variable_retrieve(cfg, args.vmcontext, "directoryintro");
if (ast_strlen_zero(dirintro))
dirintro = ast_variable_retrieve(cfg, "general", "directoryintro");
+ /* the above prompts probably should be modified to include 0 for dialing operator
+ and # for exiting (continues in dialplan) */
if (ast_test_flag(&flags, OPT_LISTBYFIRSTNAME) && ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
if (!ast_strlen_zero(opts[OPT_ARG_EITHER])) {