Skip to content
Snippets Groups Projects
Commit 1d200d55 authored by Mark Spencer's avatar Mark Spencer
Browse files

Allow '*' to exit the directory (bug #3118)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4520 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 9bf92ad7
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,8 @@ static char *descrip = ...@@ -42,7 +42,8 @@ static char *descrip =
"Returns 0 unless the user hangs up. It also sets up the channel on exit\n" "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" "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" "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, /* For simplicity, I'm keeping the format compatible with the voicemail config,
but i'm open to suggestions for isolating it */ 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 * ...@@ -243,6 +244,20 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
res = 0; 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)); memset(ext, 0, sizeof(ext));
ext[0] = digit; ext[0] = digit;
res = 0; res = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment