]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_voicemail: Emit warning if asking for nonexistent mailbox.
authorNaveen Albert <asterisk@phreaknet.org>
Wed, 16 Feb 2022 11:34:34 +0000 (11:34 +0000)
committerKevin Harwell <kharwell@digium.com>
Wed, 23 Feb 2022 22:40:56 +0000 (16:40 -0600)
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

apps/app_voicemail.c

index 32d867d030bdce163ec57df471bd95c1587c0a7b..336c78101751282867c368ba7d7b7f0b18c59cc9 100644 (file)
@@ -11617,10 +11617,16 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
                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)