Asterisk-java AMI


#1

Hi! who ever use asterisk-java for ami?
I have a connection refused exception.
I can currently connect with my terminal on the AMI.
Someone can help please…

[main] ERROR org.asteriskjava.pbx.internal.core.AsteriskPBX - java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.asteriskjava.pbx.internal.managerAPI.Connector.checkIfAsteriskRunning(Connector.java:64)
at org.asteriskjava.pbx.internal.managerAPI.Connector.connect(Connector.java:38)
at org.asteriskjava.pbx.internal.core.CoherentManagerConnection.configureConnection(CoherentManagerConnection.java:391)
at org.asteriskjava.pbx.internal.core.CoherentManagerConnection.(CoherentManagerConnection.java:173)
at org.asteriskjava.pbx.internal.core.CoherentManagerConnection.init(CoherentManagerConnection.java:124)
at org.asteriskjava.pbx.internal.core.AsteriskPBX.(AsteriskPBX.java:92)
at org.asteriskjava.pbx.internal.core.AsteriskPBX.(AsteriskPBX.java:77)
at org.asteriskjava.pbx.PBXFactory.getActivePBX(PBXFactory.java:12)
at org.asteriskjava.pbx.PBXFactory.init(PBXFactory.java:21)
at com.mycompany.crm.test.newInstence.getAsteriskPBX(newInstence.java:33)
at com.mycompany.crm.test.newInstence.(newInstence.java:25)
at com.mycompany.crm.test.Connexion.main(Connexion.java:22)


#2

I dont code on Java, but did you verify Asterisk TCP port 5038 is accesible from the Host where you are executing the Java code ?


#3

Since I can access to the Manager via telnet with the Windows cmd, I assume that port 5038 is accessible.