[Asterisk-Users] Question about using AGI - over network (with Java)?

Garry Adkins gpa2 at netacs.net
Mon Sep 8 09:58:40 MST 2003


I'm originally a Perl programmer, but have moved to java in the last few
years....

I've played around with the AGI stuff under perl, as it's very easy....
Since I prefer Java, I started experimenting a bit, but was concerned about
the huge startup times for the JVM.

I tried something a bit weird, and it worked fine, but I'm interested in
feedback, (i.e. is this a stupid idea?)

Wrote a simple threaded JVM server process, that would accept incoming
connections and process them. (new thread for each incoming connection)
I spawned netcat from a dialplan, and had it connect through the network to
the java server process  STDIN and STDOUT were connected to the pipe
Java program was already started, and just had to start a new thread to
process the AGI data, and send it back over the network to be connected to
asterisk


Java program was on a different machine, and could connect to a database,
etc.

Worked fine....  But then I noticed that there was a management interface
that was network accessable as well...  I don't even know if this is useful
or not.

Here's what I was thinking:
1)  Java has a big startup load, could overwhelm an asterisk machine and
cause scalability problems
2)  netcat seemed like a nifty solution so I could run the AGI on a
different machine, and have the database on a third!
3)  If performance became a problem, I could set up an intermediate machine
that would forward connections to the least loaded "AGI Server",
transparently to asterisk.
4)  Later I could add ssl into the mix for a bit of protection to the
network traffic

Interesting idea for scalability or stupid idea (reinventing the wheel,
etc)?

I'd be happy to provide the sample code that I used if anyone's interested.
It's quite ugly, though.... I made it a quick hack.

Any feedback very appreciated.

-G





More information about the asterisk-users mailing list