summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/app_voicemail.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 752d2a8be..a749f9251 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3061,10 +3061,19 @@ 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, ext, context);
+#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*/
+ ast_debug(1, "Greeting not retrieved from database, but found in file storage. Inserting into database\n");
+ store_file(prefile, vmu->mailbox, vmu->context, -1);
+#endif
} else {
ast_debug(1, "%s doesn't exist, doing what we can\n", prefile);
res = invent_message(chan, vmu->context, ext, ast_test_flag(options, OPT_BUSY_GREETING), ecodes);