summaryrefslogtreecommitdiff
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2015-05-12 17:45:09 -0500
committerJonathan Rose <jrose@digium.com>2015-05-13 15:28:28 -0500
commitd49d64b79c365841c01aff1b25be43af8065bd2d (patch)
tree02c61caa93eaf07fd1e245fc1b6bdbd3b65412df /apps/app_voicemail.c
parent16f602f5c2297f2d75360efe27893df00b34285a (diff)
app_voicemail: fix moving when old messages full
When completing voicemail playback of a message in the 'INBOX', the message gets moved to the 'Old' messages folder. Without this patch, if the 'Old' folder is already at its set limit, then the 'INBOX' message will simply be deleted. With this patch, the flag to delete the message will be removed if the save_to_folder function indicates that the message could not be moved due to a full folder. ASTERISK-25082 #close Reported by: Jonathan Rose Review: https://gerrit.asterisk.org/#/c/448/ Change-Id: I2be440a09f42e2d06d50975c40d1ad7f836ecb3f
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 620b76732..19bd896af 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -617,6 +617,7 @@ static AST_LIST_HEAD_STATIC(vmstates, vmstate);
#define VM_MESSAGEWRAP (1 << 17) /*!< Wrap around from the last message to the first, and vice-versa */
#define VM_FWDURGAUTO (1 << 18) /*!< Autoset of Urgent flag on forwarded Urgent messages set globally */
#define ERROR_LOCK_PATH -100
+#define ERROR_MAX_MSGS -101
#define OPERATOR_EXIT 300
enum vm_box {
@@ -7093,7 +7094,7 @@ static int save_to_folder(struct ast_vm_user *vmu, struct vm_state *vms, int msg
} else {
if (x >= vmu->maxmsg) {
ast_unlock_path(ddir);
- return -1;
+ return ERROR_MAX_MSGS;
}
}
make_file(sfn, sizeof(sfn), dir, msg);
@@ -8918,7 +8919,7 @@ static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu)
} else if ((!strcasecmp(vms->curbox, "INBOX") || !strcasecmp(vms->curbox, "Urgent")) && vms->heard[x] && ast_test_flag(vmu, VM_MOVEHEARD) && !vms->deleted[x]) {
/* Move to old folder before deleting */
res = save_to_folder(vmu, vms, x, 1, NULL, 0);
- if (res == ERROR_LOCK_PATH) {
+ if (res == ERROR_LOCK_PATH || res == ERROR_MAX_MSGS) {
/* If save failed do not delete the message */
ast_log(AST_LOG_WARNING, "Save failed. Not moving message: %s.\n", res == ERROR_LOCK_PATH ? "unable to lock path" : "destination folder full");
vms->deleted[x] = 0;