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