[svn-commits] jpeeler: branch 1.4 r295200 - /branches/1.4/apps/app_voicemail.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Nov 16 15:29:34 CST 2010


Author: jpeeler
Date: Tue Nov 16 15:29:29 2010
New Revision: 295200

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=295200
Log:
Ensure original message duration is preserved when prepending a message.

It seems the fix to issue 17103 was a little overzealous and removed the code
that backed up the textfile containing the original message duration. This 
code has now been restored.

(related to issue #17103)
ABE-2654

Modified:
    branches/1.4/apps/app_voicemail.c

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=295200&r1=295199&r2=295200
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Tue Nov 16 15:29:29 2010
@@ -3975,12 +3975,20 @@
 		recipmsgnum++;
 	} while (recipmsgnum < recip->maxmsg);
 	if (recipmsgnum < recip->maxmsg - (imbox ? 0 : inprocess_count(vmu->mailbox, vmu->context, 0))) {
-		/* If we are prepending a message for ODBC, then the message already
-		 * exists in the database, but we want to force copying from the
-		 * filesystem (since only the FS contains the prepend). */
-		copy_plain_file(frompath, topath);
-		STORE(todir, recip->mailbox, recip->context, recipmsgnum, chan, recip, fmt, duration, NULL);
-		vm_delete(topath);
+#ifndef ODBC_STORAGE
+		if (EXISTS(fromdir, msgnum, frompath, chan->language)) {
+			COPY(fromdir, msgnum, todir, recipmsgnum, recip->mailbox, recip->context, frompath, topath);
+		} else {
+#endif
+			/* If we are prepending a message for ODBC, then the message already
+			 * exists in the database, but we want to force copying from the
+			 * filesystem (since only the FS contains the prepend). */
+			copy_plain_file(frompath, topath);
+			STORE(todir, recip->mailbox, recip->context, recipmsgnum, chan, recip, fmt, duration, NULL);
+			vm_delete(topath);
+#ifndef ODBC_STORAGE
+		}
+#endif
 	} else {
 		ast_log(LOG_ERROR, "Recipient mailbox %s@%s is full\n", recip->mailbox, recip->context);
 		res = -1;
@@ -5163,6 +5171,7 @@
 	const char *duration_cstr;
 	char msgfile[PATH_MAX], backup[PATH_MAX];
 	char textfile[PATH_MAX];
+	char backup_textfile[PATH_MAX];
 	struct ast_category *msg_cat;
 	char duration_str[12] = "";
 
@@ -5171,8 +5180,10 @@
 	make_file(msgfile, sizeof(msgfile), curdir, curmsg);
 	strcpy(textfile, msgfile);
 	strcpy(backup, msgfile);
+	strcpy(backup_textfile, msgfile);
 	strncat(textfile, ".txt", sizeof(textfile) - strlen(textfile) - 1);
 	strncat(backup, "-bak", sizeof(backup) - strlen(backup) - 1);
+	strncat(backup_textfile, "-bak.txt", sizeof(backup_textfile) - strlen(backup_textfile) - 1);
 
 	if (!(msg_cfg = ast_config_load(textfile))) {
 		return -1;
@@ -5195,8 +5206,10 @@
 			/* Back up the original file, so we can retry the prepend */
 			if (already_recorded) {
 				ast_filecopy(backup, msgfile, NULL);
+				copy(textfile, backup_textfile);
 			} else {
 				ast_filecopy(msgfile, backup, NULL);
+				copy(textfile, backup_textfile);
 			}
 			already_recorded = 1;
 




More information about the svn-commits mailing list