]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
--resolve FS-4461
authorKen Rice <krice@freeswitch.org>
Wed, 3 Jul 2013 16:59:25 +0000 (11:59 -0500)
committerKen Rice <krice@freeswitch.org>
Wed, 3 Jul 2013 19:13:06 +0000 (14:13 -0500)
Add record_seconds, record_ms and record_samples variables done recording.
original patch not used due to refactor in code.

src/switch_ivr_async.c

index 18d4a3fcca8ba324cfaf586320257066080eceec..8e5a451e7ebc2c99824cdb6d357dae2200cf2ac1 100644 (file)
@@ -1212,6 +1212,12 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                                switch_event_fire(&event);
                        }
 
+                       if (read_impl.actual_samples_per_second) {
+                               switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl.actual_samples_per_second);
+                               switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl.actual_samples_per_second / 1000));
+                       }
+                       switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out);
+
                        switch_channel_execute_on(channel, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE);
 
                        if ((var = switch_channel_get_variable(channel, SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE))) {