diff --git a/aaa.prova b/aaa.prova new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.2015.vcxproj b/src/mod/applications/mod_voicemail/mod_voicemail.2015.vcxproj deleted file mode 100644 index ef91a5bea8..0000000000 --- a/src/mod/applications/mod_voicemail/mod_voicemail.2015.vcxproj +++ /dev/null @@ -1,139 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mod_voicemail - {D7F1E3F2-A3F4-474C-8555-15122571AF52} - mod_voicemail - Win32Proj - - - - DynamicLibrary - MultiByte - v140 - - - DynamicLibrary - MultiByte - v140 - - - DynamicLibrary - MultiByte - v140 - - - DynamicLibrary - MultiByte - v140 - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - - - 6385;4306;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - false - - - - - - - X64 - - - - - 6385;4306;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - false - - - MachineX64 - - - - - - - 6385;4306;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - false - - - - - - - X64 - - - - - 6385;4306;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - false - - - MachineX64 - - - - - - - - {202d7a4e-760d-4d0e-afa1-d7459ced30ff} - false - - - - - - \ No newline at end of file diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 6e14ca5095..705f6b774b 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1005,6 +1005,7 @@ typedef enum { VM_CHECK_MENU, VM_CHECK_CONFIG, VM_CHECK_PLAY_MESSAGES, + VM_CHECK_PLAY_ONE_MESSAGE, VM_CHECK_FOLDER_SUMMARY, VM_CHECK_LISTEN } vm_check_state_t; @@ -1616,7 +1617,10 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t profile->forward_key, cbt->email ? ":" : "", cbt->email ? cbt->email : ""); - switch_snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want + 1); + if(cbt->type != MSG_NONE){ + switch_snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want + 1); + } + memset(&cc, 0, sizeof(cc)); cc.profile = profile; args.buf = &cc; @@ -1966,6 +1970,8 @@ static void update_mwi(vm_profile_t *profile, const char *id, const char *domain static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *profile, const char *domain_name, const char *id, int auth, const char *uuid_in) { + // int clicktolisten = c2l; + int entra_flag = 0; vm_check_state_t vm_check_state = VM_CHECK_START; switch_channel_t *channel = switch_core_session_get_channel(session); switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(channel); @@ -1994,6 +2000,13 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p int auth_only = 0, authed = 0; switch_event_t *event; + // if (uuid_in==NULL){ + // switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "UUID NULLLLLLLLLL"); + // }else{ + // switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "subito inizio"); + // switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, uuid_in); + // } + if (!(caller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number"))) { caller_id_number = caller_profile->caller_id_number; } @@ -2065,6 +2078,13 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p switch_channel_event_set_data(channel, params); switch_event_fire(¶ms); + if(uuid_in && entra_flag==0){ + play_msg_type = MSG_NONE; + vm_check_state = VM_CHECK_PLAY_ONE_MESSAGE; + entra_flag = 1; + continue; + } + if (total_new_urgent_messages > 0) { 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)); @@ -2084,6 +2104,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p continue; } } + if (auto_play && !heard_auto_new && total_new_messages + total_new_urgent_messages > 0) { heard_auto_new = 1; @@ -2177,6 +2198,71 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p update_mwi(profile, myid, domain_name, myfolder, MWI_REASON_PURGE); } break; + case VM_CHECK_PLAY_ONE_MESSAGE: + { + + listen_callback_t cbt; + char sql[512]; + int cur_message, total_messages; + + message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages, + &total_new_urgent_messages, &total_saved_urgent_messages); + memset(&cbt, 0, sizeof(cbt)); + cbt.email = vm_email ? vm_email : email_addr; + cbt.convert_cmd = convert_cmd; + cbt.convert_ext = convert_ext; + cbt.move = VM_MOVE_NEXT; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "********************START VM_CHECK_PLAY_ONE_MESSAGE********************\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, uuid_in); + + + switch_snprintfv(sql, sizeof(sql), + "select created_epoch, read_epoch, username, domain, uuid, cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags, forwarded_by from voicemail_msgs where username='%s' and domain='%s' and uuid='%s' " + , myid, domain_name,uuid_in); + total_messages = 1; + // heard_auto_new = 1; + + + for (cur_message = 0; cur_message < total_messages; cur_message++) { + cbt.index = 0; + cbt.want = cur_message; + cbt.type = play_msg_type; + cbt.move = VM_MOVE_SAME; + vm_execute_sql_callback(profile, profile->mutex, sql, listen_callback, &cbt); + status = listen_file(session, profile, &cbt); + if (!zstr(uuid_in) && strcmp(cbt.uuid, uuid_in)) { + continue; + } + // if (cbt.move == VM_MOVE_PREV) { + // if (cur_message <= 0) { + // cur_message = -1; + // } else { + // cur_message -= 2; + // } + // } else if (cbt.move == VM_MOVE_SAME) { + // cur_message -= 1; + // } + + if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { + break; + } + } + switch_snprintfv(sql, sizeof(sql), "update voicemail_msgs set read_epoch=%ld where read_epoch=0 and " + "username='%q' and domain='%q' and flags='save'", + (long) switch_epoch_time_now(NULL), myid, domain_name); + vm_execute_sql(profile, sql, profile->mutex); + switch_snprintfv(sql, sizeof(sql), "select file_path from voicemail_msgs where username='%q' and domain='%q' and flags='delete'", myid, + domain_name); + vm_execute_sql_callback(profile, profile->mutex, sql, unlink_callback, NULL); + switch_snprintfv(sql, sizeof(sql), "delete from voicemail_msgs where username='%q' and domain='%q' and flags='delete'", myid, domain_name); + vm_execute_sql(profile, sql, profile->mutex); + vm_check_state = VM_CHECK_FOLDER_SUMMARY; + + update_mwi(profile, myid, domain_name, myfolder, MWI_REASON_PURGE); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "********************STOP VM_CHECK_PLAY_ONE_MESSAGE********************\n"); + } + break; case VM_CHECK_CONFIG: { char *sql = NULL; @@ -3740,6 +3826,8 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p SWITCH_STANDARD_APP(voicemail_function) { + // int clicktolisten = 0; + // char clicktolisten[36]; char *argv[6] = { 0 }; char *mydata = NULL; vm_profile_t *profile = NULL; @@ -3766,10 +3854,13 @@ SWITCH_STANDARD_APP(voicemail_function) } else if (argv[x] && !strcasecmp(argv[x], "auth")) { auth++; x++; - } else { + }else { break; } } + + + if (argv[x]) { profile_name = argv[x++]; @@ -3813,7 +3904,7 @@ SWITCH_STANDARD_APP(voicemail_function) if (argv[x]) { uuid = argv[x++]; } - voicemail_check_main(session, profile, domain_name, id, auth, uuid); + voicemail_check_main(session, profile, domain_name, id, auth, uuid); } else { voicemail_leave_main(session, profile, domain_name, id); } @@ -6335,4 +6426,4 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_voicemail_shutdown) * End: * For VIM: * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ + */ \ No newline at end of file