[asterisk-commits] mjordan: trunk r365477 - in /trunk: ./ apps/app_voicemail.c main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 7 13:42:53 CDT 2012


Author: mjordan
Date: Mon May  7 13:42:48 2012
New Revision: 365477

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=365477
Log:
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

Modified:
    trunk/   (props changed)
    trunk/apps/app_voicemail.c
    trunk/main/pbx.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=365477&r1=365476&r2=365477
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Mon May  7 13:42:48 2012
@@ -5834,8 +5834,9 @@
 			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 @@
 
 	/* 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);
+		ast_free(tmp);
 		pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
-		ast_free(tmp);
 		return res;
 	}
 

Modified: trunk/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/pbx.c?view=diff&rev=365477&r1=365476&r2=365477
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Mon May  7 13:42:48 2012
@@ -5262,8 +5262,9 @@
 		 * and continue, or we can drop out entirely. */
 
 		if (invalid
-			|| !ast_exists_extension(c, ast_channel_context(c), ast_channel_exten(c), 1,
-				S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->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




More information about the asterisk-commits mailing list