[svn-commits] branch jcollie/bug7063 r27191 - /team/jcollie/bug7063/apps/app_voicemail.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon May 15 09:32:30 MST 2006


Author: jcollie
Date: Mon May 15 08:57:22 2006
New Revision: 27191

URL: http://svn.digium.com/view/asterisk?rev=27191&view=rev
Log:
Consolidate some switch & if stmts, reformat...

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=27191&r1=27190&r2=27191&view=diff
==============================================================================
--- team/jcollie/bug7063/apps/app_voicemail.c (original)
+++ team/jcollie/bug7063/apps/app_voicemail.c Mon May 15 08:57:22 2006
@@ -2554,7 +2554,8 @@
 		ast_stopstream(chan);
 	/* Check for a '*' here in case the caller wants to escape from voicemail to something
 	   other than the operator -- an automated attendant or mailbox login for example */
-	if (res == '*') {
+	switch (res) {
+	case '*':
 		chan->exten[0] = 'a';
 		chan->exten[1] = '\0';
 		if (!ast_strlen_zero(vmu->exit)) {
@@ -2567,37 +2568,34 @@
 		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;
-	 }
-
+	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') {
+	case '0':
 	transfer:
 		if(ouseexten || ousemacro) {
 			chan->exten[0] = 'o';



More information about the svn-commits mailing list