From dd3343c33d324cd635996365efe7f39981a31702 Mon Sep 17 00:00:00 2001 From: Alec L Davis Date: Fri, 7 May 2010 23:54:15 +0000 Subject: VoicemailMain and VMauthenticate, allow escape to the 'a' extension when a single '*' is entered Where a site uses VoicemailMain(mailbox) the users have to be at their own extension to clear their voicemail, they have no way of escaping VoicemailMain to allow entry of new boxnumber. This patch, allows a site to include to 'a' priority in the VoicemailMain context, to allow an escape. If the 'a' priority doesn't exist in the context that VoicemailMain was called from then it acts as the old behaviour. Reported by: alecdavis Tested by: alecdavis Patch vm_a_extension.diff2.txt uploaded by alecdavis (license 585) Review: https://reviewboard.asterisk.org/r/489/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262005 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_voicemail.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'apps/app_voicemail.c') diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index fece02aca..a311b6e8d 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -250,6 +250,13 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") may be specified. If a mailbox is not provided, the calling party will be prompted to enter one. If a context is not specified, the default context will be used. + The VoiceMailMain application will exit if the following DTMF digit is entered as Mailbox + or Password, and the extension exists: + + + Jump to the a extension in the current dialplan context. + + @@ -303,6 +310,13 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") specified, only that mailbox's password will be considered valid. If the mailbox is not specified, the channel variable AUTH_MAILBOX will be set with the authenticated mailbox. + The VMAuthenticate application will exit if the following DTMF digit is entered as Mailbox + or Password, and the extension exists: + + + Jump to the a extension in the current dialplan context. + + @@ -9342,7 +9356,14 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_ ast_verb(3, "Username not entered\n"); return -1; } + } else if (mailbox[0] == '*') { + /* user entered '*' */ + if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num)) { + return -1; + } + mailbox[0] = '\0'; } + if (useadsi) adsi_password(chan); @@ -9366,6 +9387,13 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_ if (ast_readstring(chan, password, sizeof(password) - 1, 2000, 10000, "#") < 0) { ast_log(AST_LOG_WARNING, "Unable to read password\n"); return -1; + } else if (password[0] == '*') { + /* user entered '*' */ + if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num)) { + mailbox[0] = '*'; + return -1; + } + mailbox[0] = '\0'; } } @@ -9531,6 +9559,17 @@ static int vm_execmain(struct ast_channel *chan, const char *data) res = vm_authenticate(chan, vms.username, sizeof(vms.username), &vmus, context, prefixstr, skipuser, maxlogins, 0); ast_debug(1, "After vm_authenticate\n"); + + if (vms.username[0] == '*') { + ast_debug(1, "user pressed * in context '%s'\n", chan->context); + + /* user entered '*' */ + if (!ast_goto_if_exists(chan, chan->context, "a", 1)) { + res = 0; /* prevent hangup */ + goto out; + } + } + if (!res) { valid = 1; if (!skipuser) @@ -10536,6 +10575,11 @@ static int vmauthenticate(struct ast_channel *chan, const char *data) pbx_builtin_setvar_helper(chan, "AUTH_CONTEXT", vmus.context); ast_play_and_wait(chan, "auth-thankyou"); res = 0; + } else if (mailbox[0] == '*') { + /* user entered '*' */ + if (!ast_goto_if_exists(chan, chan->context, "a", 1)) { + res = 0; /* prevent hangup */ + } } return res; -- cgit v1.2.3