aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-17 19:14:05 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-17 19:14:05 +0000
commitd8b9ecad9e603ec76ad50d47356e966db46a0c52 (patch)
tree97e4c421ebf6b0f6bcd302aafba9ddef9cb9692b /apps/app_voicemail.c
parenta631984b3617c8fdbf36c8533f574e5e459988bf (diff)
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. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@79906 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 896812759..1e1803f4a 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -2869,10 +2869,20 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
/* Play the beginning intro if desired */
if (!ast_strlen_zero(prefile)) {
- RETRIEVE(prefile, -1);
+#ifdef ODBC_STORAGE
+ int success =
+#endif
+ RETRIEVE(prefile, -1);
if (ast_fileexists(prefile, NULL, NULL) > 0) {
if (ast_streamfile(chan, prefile, chan->language) > -1)
res = ast_waitstream(chan, ecodes);
+#ifdef ODBC_STORAGE
+ 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);
+#endif
} else {
if (option_debug)
ast_log(LOG_DEBUG, "%s doesn't exist, doing what we can\n", prefile);