How to get live audio stream of the ongoing call?


#1

Our use-case is
when we make/receive a call from our soft phone, firstly the request goes to our server(asterisk) which forwards the request to a SIP trunk.So in order to achieve this, we have set up an asterisk server and configured with that sip details.
In simple words we are using Asterisk as a SIP proxy that forwards the call to a SIP trunk for placing the call.

We want to get the live (real-time) audio streaming of the conversation of the on going call (both ends) to a API or web socket etc . Kindly guide us on how to achieve this.


#2

There is no built in mechanism to provide audio over an API or a Websocket, except for EAGI[1] and JACK[2].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_EAGI
[2] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_JACK


#3

Oh Thank you.

And what is snoop channel (Asterisk ARI) ? is that possible with snoop channel?


#4

I also see you and @Abhiraj are connecting from the same IP address, and have asked the same question. Posting the same thing twice won’t bring about a different answer.


#5

A Snoop channel does not forward media externally. It is for internally getting a feed from a channel and doing something with it (such as recording it).


#6

Actually we got confused with the snoop channel and LIVE recording APIs what Asterisk AGI is providing.So I posted it again for the confirmation.
Anyway Thanks for the clarification!!


#7

Hi @jcolp
We picked app_jack for our use case.Firstly we installed jack audio server and changed extensions.conf as below
[fromphones]
exten => _+91NXXNXXXXXX,1,Set(CALLERID(all)=“Trunk Test” <+91980017XXXX>)
same => n,JACK()
same => n,Dial(SIP/twilio0/${EXTEN})

When we make a call,it gets terminated with the error
pbx.c:2903 pbx_extension_helper: No application ‘JACK’ for extension fromphones

Kindly let us know whether we are doing it in the right way,if not please guide us on the steps to achieve this task.Thanks in advance.


#8

If the application does not exist then the dependencies required to build it are not met. Check “make menuselect” for what the missing dependency is and check your Linux distribution as to what the package should be.


#9

on app_jack it says depends on jack(E) and resample(E)

we have installed below
sudo apt-get install qjackctl pulseaudio-module-jack
sudo apt-get install libresample1-dev
sudo apt-get install libresample1

then we ran make install on asterisk, still it says depends on jack(E) and resample(E)


#10

Do you have the development package installed for jack? Did you re-run the configure script? Can you now select app_jack?


#11

Hi Joshua
I am working in the same subject - capturing audio streams in & out live - and I find the jack server solution a bit cumbersome.
Till now, I’ve had an external process retrieve the data from the monitor files, and streaming them to my server. Unfortunately, Asterisk 13 writes differently than previous version, and the file does not grow regularily.
I’ve seen the post: https://wiki.asterisk.org/wiki/display/AST/Stream+Support - but I fail to understand it fully. Is that implemented already ? How can I use this ?

Sorry to hijack the thread, but it is very related so I thought it was best.


#12

Stream support exists as of Asterisk 15, but it is in no way written to provide an external interface for the media. It’s an internal thing.


#13

Hi jcolp,
I want to use app_jack() for streaming the audio and my dialplan is as , in order to try JACK() I have made a dial plan like that :

exten => _+91NXXXXXXXXX,1,Set(CALLERID(all)=“Trunk Test” <+91980017XXXX>)
same => n,JACK()
same => n,Dial(SIP/twilio0/${EXTEN})

when i tried to make a call i got a error as :

Executing [+919800171547@fromphones:1] Set(“SIP/1001-00000000”, “CALLERID(all)=“Trunk Test” <+919800171547>”) in new stack
– Executing [+919800171547@fromphones:2] JACK(“SIP/1001-00000000”, “”) in new stack
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.12
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2017 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
Unknown driver “alsa”
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel,

I try to solve this, but i could not.
can you please help me.

Thanks
Abhiraj.


#14

I have never used JACK and don’t know anything else about it.


#15

seems like I’m on the same path as well. Have you made any progress? Any help will be highly appreciated. Thankyou