[Freeswitch-users] Call recording

Tihomir Culjaga tculjaga at gmail.com
Fri Jun 16 16:20:40 UTC 2017


I would not use lua, dialplan works great ;)

Sent from my iPhone

> On 16 Jun 2017, at 09:53, Sven Uszpelkat <USZPELSV at comunycarse.com> wrote:
> 
> Hi Giovanni,
>  
> Thank you for your help. We changed our script to something like this:
>  
> session:answer()
> while(session:ready() == true) do
>    test = session:recordFile("/usr/local/freeswitch/recordings/test.wav", 18000, 0, 300)
>    os.execute("sync");
>    session:setAutoHangup(false)
>    session:hangup()
> end
>  
> As result we note an improvement primarily in short recordings (<1:30 min). These are now practically all complete. In longer recordings there are still losses and it seems that they are increasing with the duration of the recording. I’m not sure how to interpret this but to me it looks like this: with the sync call we achieved to write the buffer content to the file, however in longer calls there is remaining audio which hasn’t even been read to the buffer. Is that correct? If so then the recording function doesn’t ensure to read the remaining audio after hangup. (With tcdump we checked that all audio packets arrived before the BYE message) Does this mean that this behavior is by design?
>  
> Best regards,
> Sven
>  
> De: Giovanni Maruzzelli [mailto:gmaruzz at gmail.com] 
> Enviado el: jueves, 15 de junio de 2017 13:17
> Para: Sven Uszpelkat
> CC: FreeSWITCH Users Help
> Asunto: Re: [Freeswitch-users] Call recording
>  
>  
>  
> On 15 June 2017 at 12:50, Sven Uszpelkat <USZPELSV at comunycarse.com> wrote:
>  
> 3.)    We set the silence threshold to 0 because the documentation is not very clear how to disable the silence detection. We don’t want the recording to stop in response to a period of silence. The point is to record everything.
> 
>  
> The silence_threshold determines what is considered silence, eg below what level of acoustic energy we state the stream is containing silence. Then, we wait for "how_many_silence_seconds" or until hangup before stopping recording.
> 
> So, maybe you are right, and setting it to 0 will consider silence only when there is absolute silence in the stream, so for all practical purposes, until hangup. I have no mean to check source code now.
> 
> On another hand, I can think at other possible causes for the premature end of the recorded file: maybe you move the file before it has been flushed by FreeSWITCH or by operating system? Maybe the hangup in the script interrupts the recording in the script and close the file descriptor before is flushed? (I am shooting in the dark)
> 
> You can try to leave out those two lines, and test again.
> 
> Also, you can insert a line that sync (flush) the filesystem before exiting, just to be sure.
> 
> I would insert it after the while(session:ready())
> 
> A system(sync), or something similar will probably do.
>  
> Hope this helps,
> -giovanni
> 
> 
> 
> 
>  
>  
> Best regards,
> Sven
>  
> De: FreeSWITCH-users [mailto:freeswitch-users-bounces at lists.freeswitch.org] En nombre de Giovanni Maruzzelli
> Enviado el: jueves, 15 de junio de 2017 11:19
> Para: FreeSWITCH Users Help
> Asunto: Re: [Freeswitch-users] Call recording
>  
>  
>  
> On 15 June 2017 at 09:49, Sven Uszpelkat <USZPELSV at comunycarse.com> wrote:
> Hello,
>  
> We are using FreeSWITCH as a third-party recording application, i.e. we are receiving SIP calls with the complete audio of conversations taking place on another switch and we are saving this audio to a file. To achieve this we are using a simple script similar to this:
>  
> session:answer()
> while(session:ready() == true) do
>    test = session:recordFile("/usr/local/freeswitch/recordings/test.wav", 18000, 0, 300)
>    session:setAutoHangup(false)
>    session:hangup()
> end
>  
> This script will be invoked by the following dialplan:
>  
> <extension name="Recording">
>       <condition field="destination_number" expression=".*">
>             <action application="lua" data="record.lua"/>
>       </condition>
> </extension>
>  
> Basically it seems to work quite well, but sometimes there are missing audio at the end of the recorded file.  Usually it’s only a few seconds, but sometimes it seems to be more. (It’s like the recording sometimes goes behind the real call and when the hangup event is received the remaining audio is discarded.)
>  
> What could be the reason for this behavior? Is there something wrong with the script or is there a better way to achieve our goal?
>  
> One first question come to my mind: why do you use a script here? A simple extension can do exactly the same, if you just want to record the session...
> 
> https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools:+record_session
> 
> Anyway, if you want to use the script, why you first 
> 
> session:setAutoHangup(false)
> 
> and after that you
>  
> session:hangup()
>  
> ?
>  
> Also, you made the silence_threshold equal 0 (zero). 
> Have you has the same problems using a silence_threshold of, let's say, 30 (thirty), like in documentation? ( https://freeswitch.org/confluence/display/FREESWITCH/Lua+API+Reference#LuaAPIReference-session:recordFile )
>  
> Hope this helps,
> 
> -giovanni
> 
>  
>  
> Many thanks in advance.
>  
> Best regards,
>  
> Sven Uszpelkat
> Departamento I+D
> Comunycarse Network Consultants, S.L.
>  
>  
> <image001.jpg> <image002.jpg> <image003.jpg> <image004.jpg>
> 
> Joaquín Turina, 2
> 28224 Pozuelo de Alarcón MADRID
> Tlf. +34 917 498 700
> Fax +34 917 498 720 
> 
> Sabino Arana, 18
> 08028 BARCELONA
> Tlf. +34 934 098 480
> Fax +34 934 098 490
> 
> http://www.comunycarse.com
> 
> AVISO LEGAL
> La presente comunicación y sus anexos tiene como destinatario la persona a la que va dirigida, por lo que si usted lo recibe por error debe notificarlo al remitente y eliminarlo de su sistema, no pudiendo utilizarlo, total o parcialmente, para ningún fin. Su contenido puede tener información confidencial o protegida legalmente y únicamente expresa la opinión del remitente. El uso del correo electrónico vía internet no permite asegurar ni la confidencialidad de los mensajes ni su correcta recepción. En el caso de que el destinatario no consintiera la utilización del correo electrónico deberá ponerlo en nuestro conocimiento inmediatamente.
> 
> DISCLAIMER
> This message and its attachments are intended exclusively for the named addressee. If you receive this message by mistake, please delete it immediately from your system and notify the sender. You may not use this message or any part of it for any purpose. The message may contain information that is confidential or protected by law, and any opinions expressed are those of the individual sender. Internet email guarantees neither the confidentiality nor the proper receipt of the message sent. If the addressee of this message does not consent to the use of internet e-mail, please inform us immediately.
>  
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
> 
> 
> 
> --
> 
> Sincerely,
> 
> Giovanni Maruzzelli
> OpenTelecom.IT
> cell: +39 347 266 56 18
> 
> 
> 
> --
> 
> Sincerely,
> 
> Giovanni Maruzzelli
> OpenTelecom.IT
> cell: +39 347 266 56 18
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170616/d3b11616/attachment-0001.html>


More information about the FreeSWITCH-users mailing list