Merged revisions 260923 via svnmerge from
[asterisk/asterisk.git] / apps / app_voicemail.c
index fe6ec71..acc79a7 100644 (file)
@@ -464,6 +464,7 @@ static AST_LIST_HEAD_STATIC(vmstates, vmstate);
 #define VM_MESSAGEWRAP   (1 << 17)  /*!< Wrap around from the last message to the first, and vice-versa */
 #define VM_FWDURGAUTO    (1 << 18)  /*!< Autoset of Urgent flag on forwarded Urgent messages set globally */
 #define ERROR_LOCK_PATH  -100
+#define OPERATOR_EXIT     300
 
 
 enum vm_box {
@@ -5594,7 +5595,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                        pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
                }
                ast_free(tmp);
-               return 0;
+               return OPERATOR_EXIT;
        }
 
        /* Allow all other digits to exit Voicemail and return to the dialplan */
@@ -9713,7 +9714,7 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
                                case '1': /* Reply */
                                        if (vms.lastmsg > -1 && !vms.starting) {
                                                cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 1, record_gain);
-                                               if (cmd == ERROR_LOCK_PATH) {
+                                               if (cmd == ERROR_LOCK_PATH || cmd == OPERATOR_EXIT) {
                                                        res = cmd;
                                                        goto out;
                                                }
@@ -9763,9 +9764,8 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
                                case '5': /* Leave VoiceMail */
                                        if (ast_test_flag(vmu, VM_SVMAIL)) {
                                                cmd = forward_message(chan, context, &vms, vmu, vmfmts, 1, record_gain, 0);
-                                               if (cmd == ERROR_LOCK_PATH) {
+                                               if (cmd == ERROR_LOCK_PATH || cmd == OPERATOR_EXIT) {
                                                        res = cmd;
-                                                       ast_log(AST_LOG_WARNING, "forward_message failed to lock path.\n");
                                                        goto out;
                                                }
                                        } else
@@ -10074,13 +10074,14 @@ out:
        if (res > -1) {
                ast_stopstream(chan);
                adsi_goodbye(chan);
-               if (valid) {
+               if (valid && res != OPERATOR_EXIT) {
                        if (silentexit)
                                res = ast_play_and_wait(chan, "vm-dialout");
                        else 
                                res = ast_play_and_wait(chan, "vm-goodbye");
-                       if (res > 0)
-                               res = 0;
+               }
+               if ((valid && res > 0) || res == OPERATOR_EXIT) {
+                       res = 0;
                }
                if (useadsi)
                        ast_adsi_unload_session(chan);