[Asterisk-Dev] Call control problems from Java

Zac Wolfe zacw at safisys.com
Thu Sep 30 13:16:43 MST 2004


First the good news:  I've just released a Java (JNI) bridge to Asterisk
called, JAsterisk (ya I got a little creative with the name).  It's
available at (http://sourceforge.net/projects/jasterisk/) and is pre-alpha.
It's currently distributed as a patch on the 1.0.0 source release but I hope
to have a version available soon that doesn't require any modifications to
Asterisk code.

Anyway, almost all Asterisk functionality is available and working fine from
Java.  Almost...

I have some strange issues that I'm dealing with that hopefully won't seem
so strange to someone out there:

1.  Call comes in, channel is routed to the "Safi" (Safi Systems is my
company's name) application which simply fires a callback to the JNI
notifying a Jasterisk application of it's presence, and loops while waiting
for channel hangup (like the wait_for_hangup function in app_dial.c).  The
Jasterisk application then routes the call to "Jo Blo" at some address, by
executing the Asterisk "Dial" application in a new Java thread.  When Jo
answers the call, caller and callee are connected and everything seems to be
OK.  However, if Jo then tries to transfer the call (using '#' for Zaptel
or the 'Transfer' function for IAX channels), the caller and callee are
disconnected and the call dies. Why?  If the caller calls Jo Blo directly
(as per usual) instead of being routed through the Jasterisk app, the
transfer works fine.  Similar issues are noticed when parking redirected
calls.

2. pbx.c builtin functions "Transfer" and "Goto" don't work in Jasterisk
apps.  The channel structure's members are correctly updated but the
extension or context switch never happens.  What am I missing here?

This software is in it's very early stages and it's my goal to make it the
de-facto Java-->Asterisk interface.  I'm very open to suggestions and if a
better approach is revealed I'll happily adjust or rewrite the thing from
scratch.  Eventually I'd like to be able to forgo the Asterisk dialplan
entirely (except maybe for an exten => _.,1,Safi() catch-all),  and handle
all call routing from Java, perhaps using a JTAPI interface or similar.

Progress is encouraging so far -- I've already deployed some pretty complex
production IVR's using this package and they're all stable and running fine.
However, these call routing related issues have me a little worried that I
may have taken a wrong turn somewhere.

Any ideas or recommendations? TIA

Zac Wolfe
Safi Systems LLC
zacw at safisys.com







More information about the asterisk-dev mailing list