summaryrefslogtreecommitdiff
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2012-05-07 18:42:48 +0000
committerMatthew Jordan <mjordan@digium.com>2012-05-07 18:42:48 +0000
commit9e7de73fee610939df702a9f4a4a24a6693fb239 (patch)
tree99406914172f127c82909dcece7da46fa3c0c403 /apps/app_voicemail.c
parent781f4657b91d6c8fa3dcf3bc9f0daaad5155506e (diff)
Support VoiceMail d() option when extension does not exist in channel's context
The VoiceMail d([c]) option is documented to accept digits for a new extension in context <c>, if played during the greeting. This option works fine if the extension being redirected to has an extension with the same initial digit in the channel's current context. If that digit did not happen to exist in some extension, a dialplan match would fail and the user would not be redirected. This patch fixes it such that if the <c> option is used, the extensions are matched in that context as opposed to the caller's original context. (closes issue ASTERISK-18243) Reported by: mjordan Tested by: mjordan Review: https://reviewboard.asterisk.org/r/1892 ........ Merged revisions 365474 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 365475 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@365477 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 54b199a0b..da974fcfc 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -5834,8 +5834,9 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
char e[2] = "";
e[0] = *code;
if (strchr(ecodes, e[0]) == NULL
- && ast_canmatch_extension(chan, ast_channel_context(chan), e, 1,
- S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
+ && ast_canmatch_extension(chan,
+ (!ast_strlen_zero(options->exitcontext) ? options->exitcontext : chan->context),
+ e, 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
strncat(ecodes, e, sizeof(ecodes) - strlen(ecodes) - 1);
}
}
@@ -5927,11 +5928,12 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
/* Allow all other digits to exit Voicemail and return to the dialplan */
if (ast_test_flag(options, OPT_DTMFEXIT) && res > 0) {
- if (!ast_strlen_zero(options->exitcontext))
+ if (!ast_strlen_zero(options->exitcontext)) {
ast_channel_context_set(chan, options->exitcontext);
+ }
free_user(vmu);
- pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
ast_free(tmp);
+ pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
return res;
}