[Asterisk-code-review] app voicemail: fix moving when old messages full (asterisk[certified/13.1])

Joshua Colp asteriskteam at digium.com
Wed May 13 15:44:47 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: app_voicemail: fix moving when old messages full
......................................................................


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
---
M apps/app_voicemail.c
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 8cc7b60..9fbfe7d 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -617,6 +617,7 @@
 #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 {
@@ -7064,7 +7065,7 @@
 	} else {
 		if (x >= vmu->maxmsg) {
 			ast_unlock_path(ddir);
-			return -1;
+			return ERROR_MAX_MSGS;
 		}
 	}
 	make_file(sfn, sizeof(sfn), dir, msg);
@@ -8889,7 +8890,7 @@
 		} 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;

-- 
To view, visit https://gerrit.asterisk.org/465
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2be440a09f42e2d06d50975c40d1ad7f836ecb3f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.1
Gerrit-Owner: Malcolm Davenport <malcolmd at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list