summaryrefslogtreecommitdiff
path: root/apps/app_directory.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-12-08 21:24:00 +0000
committerMark Spencer <markster@digium.com>2004-12-08 21:24:00 +0000
commit52a39dd8c1794f996d0a85c535175141e2071cef (patch)
tree0ac555380fe37aea126e88bc8b9b3a6223a0abfe /apps/app_directory.c
parent82a95912e6d1fd58a97dadd9efb5c67406ceae54 (diff)
Merge josh's exit dir patch (bug #2995)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4406 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_directory.c')
-rwxr-xr-xapps/app_directory.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c
index 306c67c08..30a268e79 100755
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -40,7 +40,9 @@ static char *descrip =
"the vm-context if unspecified. The 'f' option causes the directory to match\n"
"based on the first name in voicemail.conf instead of the last name.\n"
"Returns 0 unless the user hangs up. It also sets up the channel on exit\n"
-"to enter the extension the user selected.\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";
/* For simplicity, I'm keeping the format compatible with the voicemail config,
but i'm open to suggestions for isolating it */
@@ -227,6 +229,20 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
"(context in which to interpret extensions)\n");
return -1;
}
+ if (digit == '0') {
+ if (ast_exists_extension(chan,chan->context,"o",1,chan->cid.cid_num) ||
+ (!ast_strlen_zero(chan->macrocontext) &&
+ ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num))) {
+ strncpy(chan->exten, "o", sizeof(chan->exten)-1);
+ chan->priority = 0;
+ return 0;
+ } else {
+
+ ast_log(LOG_WARNING, "Can't find extension 'o' in current context. "
+ "Not Exiting the Directory!\n");
+ res = 0;
+ }
+ }
memset(ext, 0, sizeof(ext));
ext[0] = digit;
res = 0;