How to get live audio stream of the ongoing call?

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.

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


Oh Thank you.

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

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.

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).

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!!

Hi @jcolp
We picked app_jack for our use case.Firstly we installed jack audio server and changed extensions.conf as below
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.

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.

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)

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

1 Like

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: - 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.

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.

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.


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

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

@shashanksheela I am also behind same problem, that is getting live audio stream of a conversation. Did you find any solution? Please help if you get it solved.


incase you are still interested in this i tried to use the app_mixmonitor.c as a reference to integrate
a raw audio to websocket solution mostly based on the res_http_websocket.c builtin library that asterisk core includes. i have verified this solution to be working but not tested thoroughly yet. you can check out the project on github if you are interested:

i hope this can help someone trying to do the same thing.


1 Like

This helped me to the question, Routing RTP to an external source over WebRTC