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

Richard Mudgett asteriskteam at digium.com
Wed Mar 7 11:39:19 CST 2018


Richard Mudgett has uploaded this change for review. ( https://gerrit.asterisk.org/8463


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(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/63/8463/1

diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index db6b757..485d03f 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -13346,11 +13346,30 @@
 	astman_send_listack(s, m, "Voicemail user list will follow", "start");
 
 	AST_LIST_TRAVERSE(&users, vmu, list) {
-		char dirname[256];
 		int new, old;
-		inboxcount(vmu->mailbox, &new, &old);
+		int ret;
+		char *mailbox;
 
-		make_dir(dirname, sizeof(dirname), vmu->context, vmu->mailbox, "INBOX");
+		/* 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;
+		}
+
 		astman_append(s,
 			"Event: VoicemailUserEntry\r\n"
 			"%s"

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

Gerrit-Project: asterisk
Gerrit-Branch: 13.20
Gerrit-MessageType: newchange
Gerrit-Change-Id: I99bfec14bd4ae475b0fa1fac5a7992f3e2e8d64a
Gerrit-Change-Number: 8463
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: sungtae kim <pchero21 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180307/511578c5/attachment.html>


More information about the asterisk-code-review mailing list