diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-09-03 14:29:15 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-09-03 14:29:15 +0000 |
commit | 7d32d5562cf8b8c91a21ec13caa024ee07d57a74 (patch) | |
tree | ace6ee59b0cd2118a55f798acf564f40bff39e9b /apps | |
parent | 1aed0a2895c42cdf3d71d2dd3f7427d91159c629 (diff) |
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
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@140850 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_voicemail.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 711e9b5a5..9277cdcb3 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -3515,7 +3515,18 @@ static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int i 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 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, 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 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st /* Remove surrogate file */ vm_delete(msgfile); + DISPOSE(dir, curmsg); } /* If anything failed above, we still have this list to free */ |