[Asterisk-code-review] voicemail: Fixed wrong voicemail message count (asterisk[15])

sungtae kim asteriskteam at digium.com
Tue Mar 6 19:09:46 CST 2018


sungtae kim has uploaded this change for review. ( https://gerrit.asterisk.org/8448


Change subject: voicemail: Fixed wrong voicemail message count
......................................................................

voicemail: Fixed wrong voicemail message count

Fixed wrong voicemail mailbox reference for Action: VoicemailUsersList.

ASTERISK-27703

Change-Id: I99bfec14bd4ae475b0fa1fac5a7992f3e2e8d64a
---
M apps/app_voicemail.c
1 file changed, 22 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/8448/1

diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index d22a839..df454fe 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -13284,7 +13284,28 @@
 	AST_LIST_TRAVERSE(&users, vmu, list) {
 		char dirname[256];
 		int new, old;
-		inboxcount(vmu->mailbox, &new, &old);
+		int ret;
+		char *mailbox;
+
+		/* create mailbox string */
+		if (!ast_strlen_zero(vmu->context)) {
+			ret = ast_asprintf(&mailbox, "%s@%s", vmu->mailbox, vmu->context);
+		} else {
+			ret = ast_asprintf(&mailbox, "%s", vmu->mailbox);
+		}
+		if (ret == -1) {
+			ast_log(LOG_ERROR, "Could not create mailbox string. err[%s]\n", strerror(errno));
+			continue;
+		}
+
+		/* get mailbox count */
+		ret = inboxcount(mailbox, &new, &old);
+		ast_free(mailbox);
+		if (ret == -1) {
+			ast_log(LOG_ERROR, "Could not get mailbox count. username[%s], context[%s]\n",
+					vmu->mailbox ?: "", vmu->context ?: "");
+			continue;
+		}
 
 		make_dir(dirname, sizeof(dirname), vmu->context, vmu->mailbox, "INBOX");
 		astman_append(s,

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I99bfec14bd4ae475b0fa1fac5a7992f3e2e8d64a
Gerrit-Change-Number: 8448
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180306/e48a40e6/attachment.html>


More information about the asterisk-code-review mailing list