From 0f8fb4b1fdb7f9256f21f55ab8c28afa280e7884 Mon Sep 17 00:00:00 2001 From: Raymond Chandler Date: Thu, 17 Feb 2011 14:12:42 -0500 Subject: [PATCH] add ability to jump to a specific message --- .../applications/mod_voicemail/mod_voicemail.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 894e49a511..ef843f683c 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1725,8 +1725,7 @@ static void update_mwi(vm_profile_t *profile, const char *id, const char *domain #define FREE_DOMAIN_ROOT() if (x_user) switch_xml_free(x_user); x_user = NULL - -static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *profile, const char *domain_name, const char *id, int auth) +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) { vm_check_state_t vm_check_state = VM_CHECK_START; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -1900,6 +1899,9 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p cbt.type = play_msg_type; cbt.move = VM_MOVE_NEXT; vm_execute_sql_callback(profile, profile->mutex, sql, listen_callback, &cbt); + if (strcmp(cbt.uuid, uuid_in)) { + continue; + } status = listen_file(session, profile, &cbt); if (cbt.move == VM_MOVE_PREV) { if (cur_message <= 0) { @@ -3154,12 +3156,12 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p if (*buf != '\0') { greet_key_press: if (switch_stristr(buf, profile->login_keys)) { - voicemail_check_main(session, profile, domain_name, id, 0); + voicemail_check_main(session, profile, domain_name, id, 0, NULL); } else if ((!zstr(profile->operator_ext) || !zstr(operator_ext)) && !zstr(profile->operator_key) && !strcasecmp(buf, profile->operator_key) ) { int argc; char *argv[4]; char *mycmd; - + if ((!zstr(operator_ext) && (mycmd = switch_core_session_strdup(session, operator_ext))) || (!zstr(profile->operator_ext) && (mycmd = switch_core_session_strdup(session, profile->operator_ext)))) { argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); @@ -3292,7 +3294,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p #define VM_DESC "voicemail" -#define VM_USAGE "[check] [auth] []" +#define VM_USAGE "[check] [auth] [] [uuid]" SWITCH_STANDARD_APP(voicemail_function) { @@ -3304,6 +3306,7 @@ SWITCH_STANDARD_APP(voicemail_function) const char *domain_name = NULL; const char *id = NULL; const char *auth_var = NULL; + const char *uuid = NULL; int x = 0, check = 0, auth = 0; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -3363,7 +3366,10 @@ SWITCH_STANDARD_APP(voicemail_function) } if (check) { - voicemail_check_main(session, profile, domain_name, id, auth); + if (argv[x]) { + uuid = argv[x++]; + } + voicemail_check_main(session, profile, domain_name, id, auth, uuid); } else { voicemail_leave_main(session, profile, domain_name, id); }