summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-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;
}