FastAGI Help

Hi, I’m testing the HelloAgiScript sample in Asterisk-Java library. So far I was able to run the DefaultAgiServer I also added the extension 1300 in my default context in Asterisk

[default] exten=6050,1,VoiceMailMain exten=7000,1,Goto(voicemenu-custom-1|s|1) exten=6000,2,Goto(voicemenu-custom-2|s|1) exten=1300,1,Agi(agi://
I make a console dial 1300 in CLI and here 's what I got:

localhost*CLI> console dial 1300 -- Executing [1300@default:1] AGI("OSS/dsp", "agi://") in new stack [Jan 20 14:31:42] WARNING[6070]: res_agi.c:221 launch_netscript: Connect to 'agi://' failed: Connection refused == Auto fallthrough, channel 'OSS/dsp' status is 'UNKNOWN' << Hangup on console >>
Any idea why I’m getting this Connection Refused?

This is really more of a Asterisk-Java question than a pure asterisk question. The Connect Refused message is because the FastAGI engine in asterisk can’t make a socket connection to your java application on TCP port 4573.

There could be multiple reasons:

1 - Your java app isn’t running :smile:

2 - Your java app isn’t listening on the interface/IP you are trying to connecting to.

3 - You have a firewall on the server running the java app which is preventing connections to the FastAGI port.

I would start by doing a little bit of testing on the machine.

[make sure the JVM is running]
ps -ax | grep java

[make sure something is listening on the port]
netstat -an | grep 4573

[try a local connection to the port using telnet]
telnet localhost 4573

If all of those tests pass, then you most likely have a firewall issue preventing the asterisk machine from connecting to


Hello. Thanks for the info. I’ll check your list and get back if I get some issues. Thanks :smile:

Hi, It works. Some network issues blocking the connection. Thanks. I have another question, how can you catch the Read() application in extensions.conf? In Java, I have this method code:

[code]public void run(String mobile) throws AgiException, org.asteriskjava.manager.TimeoutException {
ManagerConnectionFactory connectionFactory = new ManagerConnectionFactory(host, manager, password);
ManagerConnection connection = connectionFactory.createManagerConnection();
OriginateAction dial = new OriginateAction();

    dial.setTimeout((long) 50000);

    try {
        ManagerResponse response = connection.sendAction(dial, 50000);
    } catch (IOException e) {
    } catch (AuthenticationFailedException e) {
    } finally {

not sure exactly what you are trying to do. If you want to capture digits and perform synchronous actions on the channel, you should probably hand off the Originated call to an AGI script (as per your other thread).

Hi, I fixed the problem. I should run the DefaultAgiServer to listen for the agi request from asterisk. Thanks for the help :smiley: