[PD] Pd + asterisk?

Russell Bryant russell at russellbryant.net
Mon Dec 17 02:48:25 CET 2007


I have been working on Jack support in Asterisk this weekend and I have it
working, as far as I can tell.  I have a Jack Asterisk dialplan application
which when executed, creates two jack ports; one port is input and the other is
output.  These ports let you access the audio that comes from the caller, as
well as control what audio gets sent back to the caller.  Once I have this
working well, I will extend the Jack interface to allow you to do fancier
things.  Right now, the jack interface is the endpoint of the phone call, but it
would be even more interesting to be able to hook into the audio path of a phone
call to another destination.

Anyway, the way that I have tested this is simply by using an application called
"Patchage".  It is a graphical jack port manager.  When I make a call, I see my
two jack ports appear.  I can connect them together and everything I say gets
sent back to me as expected.

My next step is that I want to figure out how to hook up my ports to a Pd patch,
but I haven't quite figured out how to use Jack in Pd yet.  I'm going to keep
working on it, but I figured I would post what I have in case anyone else was
curious and interested in trying it out.

Here is what I'm doing to test what I have ...

1) Install my branch of Asterisk that contains app_jack.

$ svn co http://svn.digium.com/svn/asterisk/team/russell/jack asterisk-jack
$ cd asterisk-jack
$ ./configure && make
$ sudo make install

The jack interface is in apps/app_jack.c in case anyone cares.

2) Make an entry in /etc/asterisk/extensions.conf that looks like

exten => 500,1,Answer()
exten => 500,n,Jack()

3) Make sure jackd is running.  For the sake of efficiency, specify 8 kHz,
because for most codecs used for phone calls, that's all you get.  Also, specify
160 frames per period.  For 8 kHz audio, this comes out to 20 ms periods, which
is generally the packet size used for Voice over IP.

$ sudo jackd -d dummy -r 8000 -p 160

4) Make a call to the extension created in Asterisk in step 2.  You should see
the two new jack ports become available.  In theory, they are available for
connection to any application that can use Jack.  The only thing I have done so
far is to use the "patchage" application to connect the ports directly together
to verify that the audio is flowing correctly.

Now, to figure out how to hook up arbitrary jack ports to Pd ... if anyone has
any pointers, it would be much appreciated.  I'm still very new to Pd.  :)

Russell Bryant

More information about the Pd-list mailing list