On Dec 16, 2007, at 5:48 PM, Russell Bryant wrote:
Greetings,
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 ...
- 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 installThe jack interface is in apps/app_jack.c in case anyone cares.
When building on Mac OS X/Intel 10.4.11, I got this:
[CC] app_jack.c -> app_jack.o
app_jack.c:42:20: error: values.h: No such file or directory app_jack.c: In function 'handle_input': app_jack.c:217: error: 'FLT_MAX' undeclared (first use in this function) app_jack.c:217: error: (Each undeclared identifier is reported only once app_jack.c:217: error: for each function it appears in.) app_jack.c: In function 'queue_voice_frame': app_jack.c:407: error: 'FLT_MAX' undeclared (first use in this function) make[1]: *** [app_jack.o] Error 1 make: *** [apps] Error 2
This made it build OK:
--- apps/app_jack.c (revision 94662) +++ apps/app_jack.c (working copy) @@ -39,7 +39,11 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+#ifdef __APPLE__ +#include <float.h> +#else #include <values.h> +#endif
#include <jack/jack.h> #include <jack/ringbuffer.h>
Now it's time to make it run!
.hc
- Make an entry in /etc/asterisk/extensions.conf that looks like
exten => 500,1,Answer() exten => 500,n,Jack()
- 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
- 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
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
All mankind is of one author, and is one volume; when one man dies,
one chapter is not torn out of the book, but translated into a better
language; and every chapter must be so translated.... -John Donne