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

sungtae kim asteriskteam at digium.com
Tue Mar 6 18:44:58 CST 2018


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


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: Ice2a28b6371df5c9625cd14615db69bcde53e4c2
---
M apps/app_voicemail.c
1 file changed, 21 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/47/8447/1

diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index d22a839..c4d4553 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -13284,7 +13284,27 @@
 	AST_LIST_TRAVERSE(&users, vmu, list) {
 		char dirname[256];
 		int new, old;
-		inboxcount(vmu->mailbox, &new, &old);
+		char *mailbox;
+		int ret;
+
+		/* 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. user[%s], context[%s]\n", vmu->mailbox ?: "", vmu->context ?: "");
+			return 0;
+		}
 
 		make_dir(dirname, sizeof(dirname), vmu->context, vmu->mailbox, "INBOX");
 		astman_append(s,

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice2a28b6371df5c9625cd14615db69bcde53e4c2
Gerrit-Change-Number: 8447
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/35f9baca/attachment.html>


More information about the asterisk-code-review mailing list