Skip to content

Commit

Permalink
[mod_voicemail] add option to skip goodbye
Browse files Browse the repository at this point in the history
  • Loading branch information
wmasilva authored Dec 22, 2021
1 parent e3f031f commit a92eee4
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/mod/applications/mod_voicemail/mod_voicemail.c
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ static switch_status_t create_file(switch_core_session_t *session, vm_profile_t
switch_cc_t cc = { 0 };
switch_codec_implementation_t read_impl = { 0 };
int got_file = 0;
switch_bool_t skip_record_check = switch_true(switch_channel_get_variable(channel, "skip_record_check"));
switch_bool_t skip_record_check = switch_channel_var_true(channel, "skip_record_check");

switch_core_session_get_read_impl(session, &read_impl);

Expand Down Expand Up @@ -1605,7 +1605,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
cid_buf, switch_channel_get_name(channel));
switch_core_session_receive_message(session, &msg);

if (!zstr(cbt->cid_number) && (switch_true(switch_channel_get_variable(channel, "vm_announce_cid")))) {
if (!zstr(cbt->cid_number) && (switch_channel_var_true(channel, "vm_announce_cid"))) {
TRY_CODE(switch_ivr_phrase_macro(session, VM_SAY_PHONE_NUMBER_MACRO, cbt->cid_number, NULL, NULL));
}

Expand Down Expand Up @@ -2002,7 +2002,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
auth_only = 1;
auth = 0;
} else {
auth_only = switch_true(switch_channel_get_variable(channel, "vm_auth_only"));
auth_only = switch_channel_var_true(channel, "vm_auth_only");
}

timeout = profile->digit_timeout;
Expand Down Expand Up @@ -3399,14 +3399,16 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
switch_event_t *vars = NULL;
const char *vtmp, *vm_ext = NULL;
int disk_quota = 0;
switch_bool_t skip_greeting = switch_true(switch_channel_get_variable(channel, "skip_greeting"));
switch_bool_t skip_instructions = switch_true(switch_channel_get_variable(channel, "skip_instructions"));
switch_bool_t skip_record_urgent_check = switch_true(switch_channel_get_variable(channel, "skip_record_urgent_check"));
switch_bool_t skip_greeting = switch_channel_var_true(channel, "skip_greeting");
switch_bool_t skip_instructions = switch_channel_var_true(channel, "skip_instructions");
switch_bool_t skip_record_urgent_check = switch_channel_var_true(channel, "skip_record_urgent_check");
switch_bool_t voicemail_skip_goodbye = switch_channel_var_true(channel, "voicemail_skip_goodbye");
switch_bool_t vm_enabled = SWITCH_TRUE;

switch_channel_set_variable(channel, "skip_greeting", NULL);
switch_channel_set_variable(channel, "skip_instructions", NULL);
switch_channel_set_variable(channel, "skip_record_urgent_check", NULL);
switch_channel_set_variable(channel, "voicemail_skip_goodbye", NULL);

memset(&cbt, 0, sizeof(cbt));

Expand Down Expand Up @@ -3700,7 +3702,9 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
switch_safe_free(file_path);

if (switch_channel_ready(channel) && vm_enabled) {
status = switch_ivr_phrase_macro(session, VM_GOODBYE_MACRO, NULL, NULL, NULL);
if (!voicemail_skip_goodbye) {
status = switch_ivr_phrase_macro(session, VM_GOODBYE_MACRO, NULL, NULL, NULL);
}
}

return status;
Expand Down

0 comments on commit a92eee4

Please sign in to comment.