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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 17 14:14:06 CDT 2007

Author: mmichelson
Date: Fri Aug 17 14:14:05 2007
New Revision: 79906

URL: http://svn.digium.com/view/asterisk?view=rev&rev=79906
Patch allows for more seamless transition from file storage voicemail to ODBC storage voicemail.
If a retrieval of a greeting from the database fails, but the file is found on the file system, then
we go ahead an insert the greeting into the database. The result of this is that people who
switch from file storage to ODBC storage do not need to rerecord their voicemail greetings.


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=79906&r1=79905&r2=79906
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Fri Aug 17 14:14:05 2007
@@ -2869,10 +2869,20 @@
 	/* Play the beginning intro if desired */
 	if (!ast_strlen_zero(prefile)) {
-		RETRIEVE(prefile, -1);
+		int success = 
+			RETRIEVE(prefile, -1);
 		if (ast_fileexists(prefile, NULL, NULL) > 0) {
 			if (ast_streamfile(chan, prefile, chan->language) > -1) 
 				res = ast_waitstream(chan, ecodes);
+			if(success == -1) 
+				/*We couldn't retrieve the file from the database, but we found it on the file system. Let's put it in the database*/
+				if(option_debug)
+					ast_log(LOG_DEBUG, "Greeting not retrieved from database, but found in file storage. Inserting into database\n");
+				store_file(prefile, vmu->mailbox, vmu->context, -1);
 		} else {
 			if (option_debug)
 				ast_log(LOG_DEBUG, "%s doesn't exist, doing what we can\n", prefile);

More information about the asterisk-commits mailing list