diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 73c4ee2e5a..c2f8f7f2ac 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -6950,6 +6950,16 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st #endif } DISPOSE(dir, curmsg); +#ifndef IMAP_STORAGE + if (cmd) { /* assuming hangup, cleanup backup file */ + make_file(msgfile, sizeof(msgfile), dir, curmsg); + strcpy(textfile, msgfile); + strcpy(backup_textfile, msgfile); + strncat(textfile, ".txt", sizeof(textfile) - strlen(textfile) - 1); + strncat(backup_textfile, "-bak.txt", sizeof(backup_textfile) - strlen(backup_textfile) - 1); + rename(backup_textfile, textfile); + } +#endif } /* If anything failed above, we still have this list to free */