]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add vm_auto_play=false var if you do not wish the vm to auto-play new messages
authorBrian West <brian@freeswitch.org>
Fri, 19 Mar 2010 23:56:07 +0000 (23:56 +0000)
committerBrian West <brian@freeswitch.org>
Fri, 19 Mar 2010 23:56:07 +0000 (23:56 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@17055 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_voicemail/mod_voicemail.c

index 90c17c5d4c0c619ca076624035cc1a50e30f8845..4bdae40975bf12e89047e246c65f52b119bd9b72 100644 (file)
@@ -1753,7 +1753,13 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
                                char msg_count[80] = "";
                                switch_input_args_t folder_args = { 0 };
                                switch_event_t *params;
+                               const char *vm_auto_play = switch_channel_get_variable(channel, "vm_auto_play");
+                               int auto_play = 1;
 
+                               if (vm_auto_play && !switch_true(vm_auto_play)) {
+                                       auto_play = 0;
+                               }
+                               
                                folder_args.input_callback = cancel_on_dtmf;
                                folder_args.buf = &global_buf;
                                folder_args.buflen = sizeof(global_buf);
@@ -1778,22 +1784,23 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
                                        switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-new", total_new_urgent_messages);
                                        TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, &folder_args));
                                        informed++;
-                                       if (!zstr_buf(global_buf)) {
+                                       if (auto_play && !zstr_buf(global_buf)) {
                                                vm_check_state = VM_CHECK_MENU;
                                                continue;
                                        }
                                }
+
                                if (total_new_messages > 0 && total_new_messages != total_new_urgent_messages) {
                                        switch_snprintf(msg_count, sizeof(msg_count), "%d:new", total_new_messages);
                                        TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, &folder_args));
                                        informed++;
-                                       if (!zstr_buf(global_buf)) {
+                                       if (auto_play && !zstr_buf(global_buf)) {
                                                vm_check_state = VM_CHECK_MENU;
                                                continue;
                                        }
                                }
-
-                               if (!heard_auto_new && total_new_messages + total_new_urgent_messages > 0) {
+                               
+                               if (auto_play && !heard_auto_new && total_new_messages + total_new_urgent_messages > 0) {
                                        heard_auto_new = 1;
                                        play_msg_type = MSG_NEW;
                                        vm_check_state = VM_CHECK_PLAY_MESSAGES;