]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_voicemail] add option to skip goodbye
authorwmasilva <asilva@wirelessmundi.com>
Wed, 22 Dec 2021 22:55:29 +0000 (22:55 +0000)
committerGitHub <noreply@github.com>
Wed, 22 Dec 2021 22:55:29 +0000 (01:55 +0300)
src/mod/applications/mod_voicemail/mod_voicemail.c

index dd3a74a46307c9421f39098bf14ea596a01ccf87..8f8384fab1bb0a468b6d161570eafc387d43074e 100644 (file)
@@ -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);
 
@@ -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));
                }
 
@@ -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;
@@ -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));
 
@@ -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;