Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 99077) +++ apps/app_voicemail.c (working copy) @@ -2059,6 +2059,32 @@ return strftime(s, len, "%a %b %e %r %Z %Y", &tm); } +static int play_greeting(struct ast_channel *chan, struct ast_vm_user *vmu, char *filename, char *ecodes) +{ + int res = -2; + +#ifdef ODBC_STORAGE + int success = +#endif + RETRIEVE(filename, -1); + if (ast_fileexists(filename, NULL, NULL) > 0) { + res = ast_streamfile(chan, filename, chan->language); + if (res > -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(filename, vmu->mailbox, vmu->context, -1); + } +#endif + } + DISPOSE(filename, -1); + + return res; +} + static int invent_message(struct ast_channel *chan, char *context, char *ext, int busy, char *ecodes) { int res;