Hi,
I am currently trying to retrieve the length of the most recent
recording, and I am using 'record_ms' channel variable.
However, the returned value is always '0'.
Here is the code I am using (lua):
...
session:recordFile(file, 30, 10, 10 );
local rlen = session:getVariable("record_ms"); -- rlen is Always 0
...
Any ideas why?
Looking at switch_ivr_play_say.c, I found the line that sets this
variable at the end of recording:
switch_channel_set_variable_printf(channel, "record_ms", "%d",
fh->samples_in / read_impl.samples_per_second);
switch_channel_set_variable_printf(channel, "record_samples", "%d",
fh->samples_in);
I also dumped the "record_samples" variable, which
was also 0, so there are no surprises that record_ms was 0 too.
Please also compare the first function call to the analogous with
"playback_ms"
if (read_impl.samples_per_second)
switch_channel_set_variable_printf(channel, "playback_ms", "%d",
fh->samples_out / read_impl.samples_per_second);
The second one, checks for the "0" value in the denominator; the
first one doesn't, so the potential segfault exists.
Cheers,
PV