From 9f14461cb784fa3622a40ab32356977bbbfaf0b5 Mon Sep 17 00:00:00 2001
From: Mark Spencer <markster@digium.com>
Date: Sun, 23 May 2004 04:21:42 +0000
Subject: [PATCH] Fixes to mailbox exists

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3043 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_voicemail.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 8098fe64ac..c0c3d06ec4 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3440,7 +3440,11 @@ static int vm_box_exists(struct ast_channel *chan, void *data) {
 		box = context;
 		context = "default";
 	}
-
+	while(*box) {
+		if ((*box != 'u') && (*box != 's') && (*box != 'b'))
+			break;
+		box++;
+	}
 	ast_mutex_lock(&vmlock);
 	user = users;
 	while (user) {
@@ -3448,6 +3452,7 @@ static int vm_box_exists(struct ast_channel *chan, void *data) {
 			branch = 1;
 			break;
 		}
+		user = user->next;
 	}
 	ast_mutex_unlock(&vmlock);
 
-- 
GitLab