Asterisk cmd jack



Jack Audio Connection Kit



Common options:

s(<name>): Connect to the specified jack server name
i(<name>): Connect the output port that gets created to the specified jack input port
o(<name>): Connect the input port that gets created to the specified jack output port
n: Do not automatically start the JACK server if it is not already running
c(<name>): By default, Asterisk will use the channel name for the jack client name.
Use this option to specify a custom client name.

Asterisk Version

Introduced in 1.6.x?


This is an application to connect an Asterisk channel to an input and output jack port so that the audio can be processed through another application, or to play audio from another application.

When the JACK() application is executed in the Asterisk dialplan, two JACK ports get created. There is an input and output port that acts as the endpoint of a phone call. The audio from the channel goes out of the output port that gets created. Whatever audio that comes in on the input port is what gets sent back to the caller. This allows for some advanced voice applications that interact with the audio of the call and run as a separate application.

When you use the JACK application, you get:

Incoming call audio -> Jack Application
Outgoing call audio <- Jack Application

JACK_HOOK() function: This interface is a little bit more complex, but it is the much more interesting one, in my opinion. The JACK_HOOK function creates an audiohook and attaches it to the channel. In this case, instead of the JACK interface being the endpoint of the phone call, it is simply hooked in to the audio path for a phone call to something else. Audio that comes from a caller gets sent out the JACK output port, and whatever audio that comes back in on the input port gets sent on as the caller’s audio. This allows for cool applications that do analysis and manipulation of the audio in a phone call. One example is that I can now write custom vocoders in Pd.

JACK_HOOK does the following:

Incoming call audio -> audio in to jack, audio out from jack -> current Asterisk application
Outgoing call audio <- current Asterisk application


Have you ever wanted to take the audio output of one piece of software and send it to another? How about taking the output of that same program and send it to two others, then record the result in the first program? If so, JACK may be what you’ve been looking for.
JACK is a low-latency audio server, written for POSIX conformant operating systems such as GNU/Linux and Apple’s OS X. It can connect a number of different applications to an audio device, as well as allowing them to share audio between themselves. Its clients can run in their own processes (ie. as normal applications), or can they can run within the JACK server (ie. as a “plugin”).


exten => 1234,1,Answer
exten => 1234,n,JACK()

exten => _1NXXNXXXXXX,1,Answer
exten => _1NXXNXXXXXX,n,Set(JACK_HOOK(manipulate)=on)
exten => _1NXXNXXXXXX,n,Dial(IAX2/myprovider/${EXTEN})

  • CLI> core set chanvar SIP/poly1-ab23jadf234 JACK_HOOK(manipulate) on

Note: the command above does not connect A and B legs, only opens jack ports. Use above for connecting the ports as well:
  • CLI> core set chanvar SIP/poly1-ab23jadf234 JACK_HOOK(manipulate,i(SIP/poly1-ab23jadf234:input),o(SIP/poly1-ab23jadf234:output)) on

Note 2: In asterisk 1.6.2 core set chanvar is replaced by dialplan set chanvar.

Related approaches

There are a couple of hook APIs that can be used:

to hook into audio frames:
example usage: funcs/func_volume.c

to hook into _all_ frames (1.8 and up):
no example usage yet (it's being used for T.38 Gateway support)

See also

  • Function Asterisk func jack_hook for creating an audiohook (using the Asterisk audiohookAPI)
  • Russels's blog entry for JACK and JACK_HOOK
  • JACK audio interface
  • CLI: core set chanvar (dialplan set chanvar in asterisk 1.6.2)
  • Ices: Stream Asterisk audio to icecast/shoutcast
  • SoundPatty: Recognize carrier service messages or advertisements in the audio, either using JACK_HOOK or in recoded files
  • Function Asterisk func static: Add static noise to your phone call
  • Functions AGC and DENOISE: Automatic gain control and noise reduction
  • ChanSpy and MixMonitor
  • PureData: Real-time graphical programming environment for audio, video, and graphical processing
  • Voicechanger: Manipulate the pitch of a caller
  • LADSPA: In March 2011 FreeSwitch has added support for the "Linux Audio Developer's Simple Plugin"

Created by: JustRumours, Last modification: Tue 08 of Jan, 2013 (16:09 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+