[Freeswitch-dev] recording length

Anthony Minessale anthony.minessale at gmail.com
Tue Oct 13 15:31:42 PDT 2009


This was broken on many levels.

First off the obvious one besides the potential FPE was it's using
fh->samples_in not fh->samples_out
but that value was not being computed correctly anyway and to top it off the
value has to be determined after we close the file and not before to make
sure we pick up any buffered audio.

FYI, can you please report incidents like this in the future to jira
http://jira.freeswitch.org so we can track them easier.


On Tue, Oct 13, 2009 at 1:31 PM, Peter Volchek
<pvolchek at voicemobility.com>wrote:

>  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
>
> _______________________________________________
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>


-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:213-799-1400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20091013/e96df117/attachment.html 


More information about the FreeSWITCH-dev mailing list