char e[2] = "";
e[0] = *code;
if (strchr(ecodes, e[0]) == NULL
- && ast_canmatch_extension(chan, chan->context, e, 1,
- S_COR(chan->caller.id.number.valid, chan->caller.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);
}
}
/* 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_copy_string(chan->context, options->exitcontext, sizeof(chan->context));
+ }
free_user(vmu);
- pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
ast_free(tmp);
+ pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
return res;
}
* and continue, or we can drop out entirely. */
if (invalid
- || !ast_exists_extension(c, c->context, c->exten, 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ || (ast_strlen_zero(dst_exten) &&
+ !ast_exists_extension(c, c->context, c->exten, 1,
+ S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL)))) {
/*!\note
* If there is no match at priority 1, it is not a valid extension anymore.
* Try to continue at "i" (for invalid) or "e" (for exception) or exit if