[Freeswitch-users] Capturing the Current Call Audio

Avi Marcus avi at avimarcus.net
Thu Oct 13 12:14:45 MSD 2016


Hi all, 13 months later I finally got to playing with it:

This worked on debian jessie 8.1 with `apt-get install -y sox tshark` to
transform PCAPs to a standard wav file.

It's here in a gist so you can see the *few *changes that I had to make:

https://gist.github.com/avimar/d2e9d05e082ce273962d742eb9acac16


Thanks Michael for the original code! Should I put an MIT
<https://en.wikipedia.org/wiki/MIT_License> license on it? or MPL 1.1 like
FS or 2.0..

-Avi Marcus
BestFone

On Tue, Sep 15, 2015 at 1:45 AM, Michael Collins <msc at freeswitch.org> wrote:

> Avi,
>
> Here is a Linux script I wrote a while back. Some assembly required, see
> store for details, batteries not included, your mileage may vary...
>
> If you decide to use it and it works please feel free upload to the wiki
> or donate to the project.
>
> -Michael
>
>
> On Sat, Sep 12, 2015 at 10:35 AM, Avi Marcus <avi at avimarcus.net> wrote:
>
>> I use wireshark to look at the SIP packets or listen to the audio. But I
>> haven't found a simple script to export e.g. a WAV from the pcap... if
>> someone finds, please let us know!
>>
>> -Avi
>>
>> On Sat, Sep 12, 2015 at 5:25 PM, ik <idokan at gmail.com> wrote:
>>
>>> It does has the RTP (and RTCP).
>>> You can export one or more calls to the same file.
>>>
>>> On Sat, Sep 12, 2015 at 12:27 AM, Leonardo Lima Ribeiro <
>>> llribeiro90 at gmail.com> wrote:
>>>
>>>> And from the cap file I can get the audio right?
>>>> I’m taking a look in some scripts that can extract the audio from pcap
>>>> files, but I think it’s need to be embedded on the pcap file when it’s
>>>> saving right?
>>>>
>>>> I tried the sngrep and it generated a 128k pcap file, and I did about 3
>>>> calls, does it really have the audio?
>>>>
>>>> (I’m about to test pcapsipdump but the installation is failing in OS X,
>>>> I think I will move to a CentOS machine)
>>>>
>>>> Thank you all guys!
>>>>
>>>> Em 11/09/2015, à(s) 2:47 PM, ik <idokan at gmail.com> escreveu:
>>>>
>>>> I'm using sngrep, it saves a specific dialog to a pcap file, or several
>>>> dialogs, based on what you select.
>>>>
>>>> On Fri, Sep 11, 2015 at 4:58 PM, Aqs Younas <aqsyounas at gmail.com>
>>>> wrote:
>>>>
>>>>> pcapsipdump captures all calls on particular instance into separate
>>>>> files. You can't make it to capture a specific file.
>>>>>
>>>>> On 11 September 2015 at 16:43, Leonardo Ribeiro <llribeiro90 at gmail.com
>>>>> > wrote:
>>>>>
>>>>>> Sorry all, it was my phone auto corrector. Again:
>>>>>>
>>>>>> Thanks Avi,
>>>>>>
>>>>>> I had read about and I'm going to try that. My IVR is a script on
>>>>>> lua, do you know how can I call the  pcapsipdump for the current call from
>>>>>> there?
>>>>>>
>>>>>> I was thinking about another solution... What if I execute a record
>>>>>> mycall.wav 300 and try to stream this file while is being record? It would
>>>>>> work? The main problem is that the script calls the execute record as a
>>>>>> synchronous way, but I would need to do some actions while it's recording
>>>>>> like play sounds, curl posts etc.
>>>>>>
>>>>>> Thank you!
>>>>>> Em 11/09/2015 08:38, "Leonardo Ribeiro" <llribeiro90 at gmail.com>
>>>>>> escreveu:
>>>>>>
>>>>>>> Thanks Avi,
>>>>>>>
>>>>>>> I've readed about and I'm going to try that. My IVR is a script on
>>>>>>> lua, do you know how can I call the  pcapsipdump for the current call from
>>>>>>> there?
>>>>>>>
>>>>>>> I was thinking Abou another solution, and what if I execute a record
>>>>>>> mycall.wav 300 and try to stream this file while is being record? It would
>>>>>>> work? The main problem is that the script calls the execute record as a
>>>>>>> synchronous way, but I would need to do some actions while it's recording
>>>>>>> like play sounds, curl posta etc.
>>>>>>>
>>>>>>> Thanks you!
>>>>>>> Em 10/09/2015 23:08, "Avi Marcus" <avi at avimarcus.net> escreveu:
>>>>>>>
>>>>>>>> I use pcapsipdump to capture all call SIP + RTP, grouped by call in
>>>>>>>> PCAP format.
>>>>>>>>
>>>>>>>> -Avi
>>>>>>>>
>>>>>>>> On Fri, Sep 11, 2015 at 4:36 AM, Leonardo Lima Ribeiro <
>>>>>>>> llribeiro90 at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi!
>>>>>>>>>
>>>>>>>>> I’m tying to capture the current call audio but I have no idea on
>>>>>>>>> how to do that.
>>>>>>>>>
>>>>>>>>> My main achievement is to get the current call audio and them
>>>>>>>>> stream this audio bytes to an API via HTTP Post.
>>>>>>>>>
>>>>>>>>> I was doing some tries with mod_shout and mod_vlc, and I was
>>>>>>>>> successful in the streaming part - I tested some wavs and mp3 files.
>>>>>>>>>
>>>>>>>>> But the mainly part is that I need the current call audio, and it
>>>>>>>>> has no file in the system to stream right?
>>>>>>>>>
>>>>>>>>> I was thinking if there’s a command that I can get the audio bytes
>>>>>>>>> from the current call but I really don’t know, I could not find any option
>>>>>>>>> like that.
>>>>>>>>>
>>>>>>>>> Could you please help me?
>>>>>>>>>
>>>>>>>>> Thank you,
>>>>>>>>> Leonardo Ribeiro
>>>>>>>>> ____________________________________________________________
>>>>>>>>> _____________
>>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ____________________________________________________________
>>>>>>>> _____________
>>>>>>>> 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
>>>>>>>>
>>>>>>>
>>>>>> ____________________________________________________________
>>>>>> _____________
>>>>>> 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
>>>>>>
>>>>>
>>>>>
>>>>> ____________________________________________________________
>>>>> _____________
>>>>> 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
>>>>>
>>>>
>>>> ____________________________________________________________
>>>> _____________
>>>> 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
>>>>
>>>>
>>>>
>>>> ____________________________________________________________
>>>> _____________
>>>> 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
>>>>
>>>
>>>
>>> ____________________________________________________________
>>> _____________
>>> 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
>>>
>>
>>
>> _________________________________________________________________________
>> 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
>>
>
>
> _________________________________________________________________________
> 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/20161013/ed176e3b/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list