[asterisk-commits] mmichelson: branch 1.4 r140850 - /branches/1.4/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 3 09:29:16 CDT 2008


Author: mmichelson
Date: Wed Sep  3 09:29:15 2008
New Revision: 140850

URL: http://svn.digium.com/view/asterisk?view=rev&rev=140850
Log:
Fix voicemail forwarding when using ODBC storage.

(closes issue #13387)
Reported by: moliveras
Patches:
      13387.patch uploaded by putnopvut (license 60)
Tested by: putnopvut, moliveras


Modified:
    branches/1.4/apps/app_voicemail.c

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=140850&r1=140849&r2=140850
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Wed Sep  3 09:29:15 2008
@@ -3515,7 +3515,18 @@
 		recipmsgnum++;
 	} while (recipmsgnum < recip->maxmsg);
 	if (recipmsgnum < recip->maxmsg) {
-		COPY(fromdir, msgnum, todir, recipmsgnum, recip->mailbox, recip->context, frompath, topath);
+		if (EXISTS(fromdir, msgnum, frompath, chan->language)) {
+			COPY(fromdir, msgnum, todir, recipmsgnum, recip->mailbox, recip->context, frompath, topath);
+		} else {
+			/* For ODBC storage, if the file we want to copy isn't yet in the database, then the SQL
+			 * copy will fail. Instead, we need to create a local copy, store it, and delete the local
+			 * copy. We don't have to #ifdef this because if file storage reaches this point, there's a
+			 * much worse problem happening and IMAP storage doesn't call this function
+			 */
+			copy_plain_file(frompath, topath);
+			STORE(todir, recip->mailbox, recip->context, recipmsgnum, chan, recip, fmt, duration, NULL);
+			vm_delete(topath);
+		}
 	} else {
 		ast_log(LOG_ERROR, "Recipient mailbox %s@%s is full\n", recip->mailbox, recip->context);
 	}
@@ -4743,7 +4754,6 @@
 				snprintf(duration_str, 11, "%d", prepend_duration);
 				if (!ast_variable_update(msg_cat, "duration", duration_str, NULL, 0)) {
 					config_text_file_save(textfile, msg_cfg, "app_voicemail");
-					STORE(curdir, vmu->mailbox, context, curmsg, chan, vmu, vmfmts, prepend_duration, vms);
 				}
 			}
 
@@ -5054,6 +5064,7 @@
 
 		/* Remove surrogate file */
 		vm_delete(msgfile);
+		DISPOSE(dir, curmsg);
 	}
 
 	/* If anything failed above, we still have this list to free */




More information about the asterisk-commits mailing list