Revision
17055
Author
brian
Date
2010-03-19 18:56:07 -0500 (Fri, 19 Mar 2010)

Log Message

add vm_auto_play=false var if you do not wish the vm to auto-play new messages

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (17054 => 17055)


--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	2010-03-19 23:40:30 UTC (rev 17054)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	2010-03-19 23:56:07 UTC (rev 17055)
@@ -1753,7 +1753,13 @@
 				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 @@
 					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;