]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3797 --resolve
authorMarc Olivier Chouinard <mochouinard@moctel.com>
Wed, 4 Jan 2012 05:18:36 +0000 (00:18 -0500)
committerMarc Olivier Chouinard <mochouinard@moctel.com>
Wed, 4 Jan 2012 05:18:36 +0000 (00:18 -0500)
I've remade the patch to use len format used in other voicemail_message_len variable/event to be consistant

src/mod/applications/mod_voicemail/mod_voicemail.c

index 16dd999c99cf4d414cf7ac972d00f6bd4d03b07a..d5397e5465d46ad64dd7c30f1d7bf2350d330132 100644 (file)
@@ -3450,7 +3450,20 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
                                                        switch_core_session_get_pool(session), caller_id_name, caller_id_number, NULL, SWITCH_FALSE,
                                                        session ? switch_core_session_get_uuid(session) : NULL, session);
                switch_event_destroy(&vars);
-               if (status != SWITCH_STATUS_SUCCESS) {
+               if (status == SWITCH_STATUS_SUCCESS) {
+                       switch_core_time_duration_t duration;
+                       char duration_str[80];
+                       switch_time_t l_duration = switch_time_make(message_len, 0);
+
+                       switch_core_measure_time(l_duration, &duration);
+                       duration.day += duration.yr * 365;
+                       duration.hr += duration.day * 24;
+
+                       switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", duration.hr, duration.min, duration.sec);
+
+                       switch_channel_set_variable(channel, "voicemail_message_len", duration_str);
+
+               } else {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to deliver message\n");
                        TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "deleted", NULL, NULL));
                }