Add some extra checks & verbosity (bug #3686)
[asterisk/asterisk.git] / apps / app_voicemail.c
index 021b59a..8f7adb3 100755 (executable)
@@ -4436,15 +4436,20 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_
                logretries++;
                if (!valid) {
                        if (skipuser || logretries >= maxlogins) {
-                               if (ast_streamfile(chan, "vm-incorrect", chan->language))
-                                       break;
+                               if (ast_streamfile(chan, "vm-incorrect", chan->language)) {
+                                       ast_log(LOG_WARNING, "Unable to stream incorrect message\n");
+                                       return -1;
+                               }
                        } else {
                                if (useadsi)
                                        adsi_login(chan);
-                               if (ast_streamfile(chan, "vm-incorrect-mailbox", chan->language))
-                                       break;
+                               if (ast_streamfile(chan, "vm-incorrect-mailbox", chan->language)) {
+                                       ast_log(LOG_WARNING, "Unable to stream incorrect mailbox message\n");
+                                       return -1;
+                               }
                        }
-                       ast_waitstream(chan, "");
+                       if (ast_waitstream(chan, ""))   /* Channel is hung up */
+                               return -1;
                }
        }
        if (!valid && (logretries >= maxlogins)) {