[asterisk-commits] branch jcollie/bug7063 r27020 - /team/jcollie/bug7063/apps/app_voicemail.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu May 11 14:15:03 MST 2006


Author: jcollie
Date: Thu May 11 16:15:02 2006
New Revision: 27020

URL: http://svn.digium.com/view/asterisk?rev=27020&view=rev
Log:
Apply patch from bug 7063.

Modified:
    team/jcollie/bug7063/apps/app_voicemail.c

Modified: team/jcollie/bug7063/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/bug7063/apps/app_voicemail.c?rev=27020&r1=27019&r2=27020&view=diff
==============================================================================
--- team/jcollie/bug7063/apps/app_voicemail.c (original)
+++ team/jcollie/bug7063/apps/app_voicemail.c Thu May 11 16:15:02 2006
@@ -2436,6 +2436,9 @@
 	struct ast_vm_user svm;
 	const char *category = NULL;
 
+	int vmx = 0;
+	char strvmx[2], strvmext[4];
+	
 	ast_copy_string(tmp, ext, sizeof(tmp));
 	ext = tmp;
 	context = strchr(tmp, '@');
@@ -2503,6 +2506,20 @@
 		ausemacro = 1;
 	}
 
+	for (vmx = 1; vmx <= 9; vmx++) {
+		snprintf(strvmx, sizeof(strvmx), "%d", vmx);
+		snprintf(strvmext, sizeof(strvmext), "vm%d", vmx);
+		
+		if (!ast_strlen_zero(vmu->exit)) {
+			if (ast_exists_extension(chan, vmu->exit, strvmext, 1, chan->cid.cid_num))
+				strncat(ecodes, strvmx, sizeof(ecodes) -  strlen(ecodes) - 1);
+		} else if (ast_exists_extension(chan, chan->context, strvmext, 1, chan->cid.cid_num))
+			strncat(ecodes, strvmx, sizeof(ecodes) -  strlen(ecodes) - 1);
+		else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, strvmext, 1, chan->cid.cid_num)) {
+			strncat(ecodes, strvmx, sizeof(ecodes) -  strlen(ecodes) - 1);
+		}
+	}
+
 	/* Play the beginning intro if desired */
 	if (!ast_strlen_zero(prefile)) {
 		RETRIEVE(prefile, -1);
@@ -2547,9 +2564,37 @@
 		}
 		chan->priority = 0;
 		free_user(vmu);
+		pbx_builtin_setvar_helper(chan, "VMMAILBOX", vmu->mailbox);
 		pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
 		return 0;
 	}
+	/* Check for res = 1-9, goto vm${res} */
+	switch (res) {
+		case '1': 
+		case '2': 
+		case '3': 
+		case '4': 
+		case '5': 
+		case '6': 
+		case '7': 
+		case '8': 
+		case '9': 
+			chan->exten[0] = 'v';
+			chan->exten[1] = 'm';
+			chan->exten[2] = res;
+			chan->exten[3] = '\0';
+			if (!ast_strlen_zero(vmu->exit)) {
+				ast_copy_string(chan->context, vmu->exit, sizeof(chan->context));
+			} else if (!ast_strlen_zero(chan->macrocontext)) {
+				ast_copy_string(chan->context, chan->macrocontext, sizeof(chan->context));
+			}
+			chan->priority = 0;
+			free_user(vmu);
+			pbx_builtin_setvar_helper(chan, "VMMAILBOX", vmu->mailbox);
+			pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
+			return 0;
+	 }
+
 
 	/* Check for a '0' here */
 	if (res == '0') {
@@ -2565,6 +2610,7 @@
 			ast_play_and_wait(chan, "transfer");
 			chan->priority = 0;
 			free_user(vmu);
+			pbx_builtin_setvar_helper(chan, "VMMAILBOX", vmu->mailbox);
 			pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
 		}
 		return 0;



More information about the asterisk-commits mailing list