From ef998869b3cbca462ff3272a0922cb9988223663 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 19 Mar 2010 23:56:07 +0000 Subject: [PATCH] add vm_auto_play=false var if you do not wish the vm to auto-play new messages git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@17055 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../mod_voicemail/mod_voicemail.c | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 90c17c5d4c..4bdae40975 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -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)) { - 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 (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 (auto_play && !zstr_buf(global_buf)) { + vm_check_state = VM_CHECK_MENU; + continue; + } + } + + 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;