aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_directory.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-21 22:43:25 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-21 22:43:25 +0000
commitae89345fd94dbbc3404611ae5a403098e74a3d33 (patch)
tree806dcf39f8757f0e185311339eeb62a60009ec27 /apps/app_directory.c
parent856e95865766eb7a7801067d8e8496809f71dc6e (diff)
Allow '*' to exit the directory (bug #3118)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4520 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_directory.c')
-rwxr-xr-xapps/app_directory.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c
index 30a268e79..cc2d96c39 100755
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -42,7 +42,8 @@ static char *descrip =
"Returns 0 unless the user hangs up. It also sets up the channel on exit\n"
"to enter the extension the user selected. If the user enters '0' and there\n"
"exists an extension 'o' in the current context, the directory will exit with 0\n"
-"and call control will resume at that extension.\n";
+"and call control will resume at that extension. Entering '*' will exit similarly,\n"
+"but to the 'a' extension, much like app_voicemail's behavior.\n";
/* For simplicity, I'm keeping the format compatible with the voicemail config,
but i'm open to suggestions for isolating it */
@@ -243,6 +244,20 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
res = 0;
}
}
+ if (digit == '*') {
+ if (ast_exists_extension(chan,chan->context,"a",1,chan->cid.cid_num) ||
+ (!ast_strlen_zero(chan->macrocontext) &&
+ ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num))) {
+ strncpy(chan->exten, "a", sizeof(chan->exten)-1);
+ chan->priority = 0;
+ return 0;
+ } else {
+
+ ast_log(LOG_WARNING, "Can't find extension 'a' in current context. "
+ "Not Exiting the Directory!\n");
+ res = 0;
+ }
+ }
memset(ext, 0, sizeof(ext));
ext[0] = digit;
res = 0;