[asterisk-commits] tilghman: branch 1.2 r55434 - /branches/1.2/apps/app_voicemail.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Feb 19 11:09:10 MST 2007


Author: tilghman
Date: Mon Feb 19 12:09:09 2007
New Revision: 55434

URL: http://svn.digium.com/view/asterisk?view=rev&rev=55434
Log:
forcename and forcegreetings options should check to see if the recording already exists

Modified:
    branches/1.2/apps/app_voicemail.c

Modified: branches/1.2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_voicemail.c?view=diff&rev=55434&r1=55433&r2=55434
==============================================================================
--- branches/1.2/apps/app_voicemail.c (original)
+++ branches/1.2/apps/app_voicemail.c Mon Feb 19 12:09:09 2007
@@ -4711,21 +4711,28 @@
 	/* If forcename is set, have the user record their name */	
 	if (ast_test_flag(vmu, VM_FORCENAME)) {
 		snprintf(prefile,sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vms->username);
-		cmd = play_record_review(chan,"vm-rec-name",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain);
-		if (cmd < 0 || cmd == 't' || cmd == '#')
-			return cmd;
+		if (ast_fileexists(prefile, NULL, NULL) < 1) {
+			cmd = play_record_review(chan, "vm-rec-name", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain);
+			if (cmd < 0 || cmd == 't' || cmd == '#')
+				return cmd;
+		}
 	}
 
 	/* If forcegreetings is set, have the user record their greetings */
 	if (ast_test_flag(vmu, VM_FORCEGREET)) {
 		snprintf(prefile,sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, vms->username);
-		cmd = play_record_review(chan,"vm-rec-unv",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain);
-		if (cmd < 0 || cmd == 't' || cmd == '#')
-			return cmd;
+		if (ast_fileexists(prefile, NULL, NULL) < 1) {
+			cmd = play_record_review(chan, "vm-rec-unv", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain);
+			if (cmd < 0 || cmd == 't' || cmd == '#')
+				return cmd;
+		}
+
 		snprintf(prefile,sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, vms->username);
-		cmd = play_record_review(chan,"vm-rec-busy",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain);
-		if (cmd < 0 || cmd == 't' || cmd == '#')
-			return cmd;
+		if (ast_fileexists(prefile, NULL, NULL) < 1) {
+			cmd = play_record_review(chan, "vm-rec-busy", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain);
+			if (cmd < 0 || cmd == 't' || cmd == '#')
+				return cmd;
+		}
 	}
 
 	return cmd;



More information about the asterisk-commits mailing list