Problems to handle a connection on AGI

Hi Guys!

We are trying to build a dialer with asterisk and asterisk-java libs. We can start a call to a extension, but it ends as soon it is answered.

Our asterisk server is at 192.168.22.9

Our java server is at 192.168.5.164

When monitoring, we see this log at rasterisk -vvvv

Connected to Asterisk certified/13.21-cert2 currently running on REALPBX (pid = 596)
== Manager ‘admin’ logged off from 192.168.5.164
== Connect attempt from ‘192.168.5.164’ unable to authenticate
== Manager ‘admin’ logged on from 192.168.5.164
== Using SIP RTP CoS mark 5
– Called 1004
– SIP/1004-00000007 is ringing
[Aug 14 09:51:44] NOTICE[657]: chan_sip.c:28463 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 1004
> 0x7f68fc004840 – Strict RTP learning after remote address set to: 192.168.5.164:12210
– SIP/1004-00000007 answered
– Executing [asterisk-java-agi@asteriskjava:1] AGI(“SIP/1004-00000007”, “agi://192.168.22.9/activityAgi”) in new stack
[Aug 14 09:51:46] WARNING[848][C-00000007]: res_agi.c:2039 handle_connection: Connecting to ‘192.168.22.9:4573’ failed for url ‘agi://192.168.22.9/activityAgi’: Connection refused
[Aug 14 09:51:46] WARNING[848][C-00000007]: res_agi.c:2104 launch_netscript: Couldn’t connect to any host. FastAGI failed.
– Auto fallthrough, channel ‘SIP/1004-00000007’ status is ‘UNKNOWN’

We are missing something, thanks for any help.

Our configuration file:

public class ExamplesAsteriskSettings extends DefaultAsteriskSettings{
@Override
public String getManagerPassword(){
// this password MUST match the password (secret=) in manager.conf
return “senha”;
}
@Override
public String getManagerUsername(){
// this MUST match the section header ‘[myconnection]’ in manager.conf
return “admin”;
}
@Override
public String getAsteriskIP(){
// The IP address or FQDN of your Asterisk server.
return “192.168.22.9”;
}
@Override
public String getAgiHost(){
// The IP Address or FQDN of you asterisk-java application.
return “192.168.5.164”;
}
}

Our code (nearly the same from documentation tutorial):

PBX pbx = PBXFactory.getActivePBX();
// We are going to dial from extension 100 to 5551234
// The trunk is used to select which SIP trunk to dial through.
Trunk trunk = pbx.buildTrunk(“tronco_ypy_movel”);
// We are going to dial from extension 100
EndPoint from = pbx.buildEndPoint(TechType.SIP, “1004”);
// Provide confirmation to the agent which no. we are dialing by
// showing it on their handset.
CallerID fromCallerID = pbx.buildCallerID(“5558100”, “Dialing”);
// The caller ID to display on the called parties phone.
// On most systems the caller id name part won’t display
CallerID toCallerID = pbx.buildCallerID(“5558101”, “Asterisk Java is calling”);
// The party we are going to call.
//EndPoint to = pbx.buildEndPoint(TechType.SIP, trunk, “1004”);
EndPoint to = pbx.buildEndPoint(TechType.SIP, trunk, “5558100”);
// Now dial. This method won’t return until the call is answered
// or the dial timeout is reached.
DialActivity dial = pbx.dial(from, fromCallerID, to, toCallerID);
// We should have a live call here. But we got null.
Call call = dial.getNewCall();

The exception made at pbx.dial(from, fromCallerID, to, toCallerID);

org.asteriskjava.pbx.PBXException: OperatorEndedCall

What do you not understand about this message?

Hi David!

I´m not sure, but I think this message means that asterisk server (res_agi.c at line 2039) is trying to respond or send a message to a resource (activityAgi).

I dont know if activityAgi is owned by Asterisk Java Application Server or by the Asterisk Server.

res_agi.c needs to connect with Asterisk (localhost or 192.168.22.9) or with my Asterisk Java Application/Server (192.168.5.164)?

WARNING[1509][C-0000000a]: res_agi.c:2039 handle_connection: Connecting to '192.168.22.9:4573' failed for url 'agi://192.168.22.9/activityAgi': Connection refused

It is attempting to connect to 192.168.22.9 port 4573 to talk to the AGI server. That would be your Asterisk Java Application Server, and it is unable to connect.

Thank you guys!

Problem solved. The asterisk-java server was not fully avaliable on my network.