[Asterisk-code-review] app_voicemail: Emit warning if asking for nonexistent mailbox. (asterisk[19])

Kevin Harwell asteriskteam at digium.com
Wed Feb 23 16:41:42 CST 2022


Kevin Harwell has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18055 )

Change subject: app_voicemail: Emit warning if asking for nonexistent mailbox.
......................................................................

app_voicemail: Emit warning if asking for nonexistent mailbox.

Currently, if VoiceMailMain is called with a mailbox, if that
mailbox doesn't exist, then the application silently falls back
to prompting the user for the mailbox, as if no arguments were
provided.

However, if a specific mailbox is requested and it doesn't exist,
then no warning at all is emitted.

This fixes this behavior to now warn if a specifically
requested mailbox could not be accessed, before falling back to
prompting the user for the correct mailbox.

ASTERISK-29920 #close

Change-Id: Ib4093b88cd661a2cabc5d685777d4e2f0ebd20a4
---
M apps/app_voicemail.c
1 file changed, 9 insertions(+), 3 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved; Approved for Submit



diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 6dec471..49d30e0 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -11512,10 +11512,16 @@
 		else
 			ast_copy_string(vms.username, args.argv0, sizeof(vms.username));
 
-		if (!ast_strlen_zero(vms.username) && (vmu = find_user(&vmus, context ,vms.username)))
-			skipuser++;
-		else
+		if (!ast_strlen_zero(vms.username)) {
+			if ((vmu = find_user(&vmus, context ,vms.username))) {
+				skipuser++;
+			} else {
+				ast_log(LOG_WARNING, "Mailbox '%s%s%s' doesn't exist\n", vms.username, context ? "@": "", context ? context : "");
+				valid = 0;
+			}
+		} else {
 			valid = 0;
+		}
 	}
 
 	if (!valid)

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18055
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 19
Gerrit-Change-Id: Ib4093b88cd661a2cabc5d685777d4e2f0ebd20a4
Gerrit-Change-Number: 18055
Gerrit-PatchSet: 2
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220223/548ef29e/attachment-0001.html>


More information about the asterisk-code-review mailing list