Hello all!!
I am trying to make an example work, taken from: asterisk-java.org/development/tutorial.html (Manager API example)
[code]import java.io.IOException;
import org.asteriskjava.manager.AuthenticationFailedException;
import org.asteriskjava.manager.ManagerConnection;
import org.asteriskjava.manager.ManagerConnectionFactory;
import org.asteriskjava.manager.TimeoutException;
import org.asteriskjava.manager.action.OriginateAction;
import org.asteriskjava.manager.response.ManagerResponse;
public class HelloManager
{
private ManagerConnection managerConnection;
public HelloManager() throws IOException
{
ManagerConnectionFactory factory = new ManagerConnectionFactory(
"localhost", "manager", "pa55w0rd");
this.managerConnection = factory.createManagerConnection();
}
public void run() throws IOException, AuthenticationFailedException,
TimeoutException
{
OriginateAction originateAction;
ManagerResponse originateResponse;
originateAction = new OriginateAction();
originateAction.setChannel("SIP/John");
originateAction.setContext("default");
originateAction.setExten("1300");
originateAction.setPriority(new Integer(1));
originateAction.setTimeout(new Integer(30000));
// connect to Asterisk and log in
managerConnection.login();
// send the originate action and wait for a maximum of 30 seconds for Asterisk
// to send a reply
originateResponse = managerConnection.sendAction(originateAction, 30000);
// print out whether the originate succeeded or not
System.out.println(originateResponse.getResponse());
// and finally log off and disconnect
managerConnection.logoff();
}
public static void main(String[] args) throws Exception
{
HelloManager helloManager;
helloManager = new HelloManager();
helloManager.run();
}
}[/code]
The example compiles, the call goes into asterisk, but agi output is:
<SIP/xx.xx.xxx.xx-0000008b>AGI Rx << Asterisk Call Manager/1.1
<SIP/xx.xx.xxx.xx-0000008b>AGI Tx >> 510 Invalid or unknown command
<SIP/xx.xx.xxx.xx-0000008b>AGI Rx << Response: Error
<SIP/xx.xx.xxx.xx-0000008b>AGI Tx >> 510 Invalid or unknown command
<SIP/xx.xx.xxx.xx-0000008b>AGI Rx << Message: Missing action in request
<SIP/xx.xx.xxx.xx-0000008b>AGI Tx >> 510 Invalid or unknown command
WARNING[1229]: chan_sip.c:3780 retrans_pkt: Maximum retries exceeded on transmission xxxxxxxxxxx@xx.xx.xxx.xx for seqno 102 (Critical Response) – See doc/sip-retransmit.txt.
WARNING[1229]: chan_sip.c:3780 retrans_pkt: Maximum retries exceeded on transmission xxxxxxxxxxx@xx.xx.xxx.xx for seqno 102 (Critical Response) – See doc/sip-retransmit.txt.
WARNING[1229]: chan_sip.c:3807 retrans_pkt: Hanging up call xxxxxxxxxxx@xx.xx.xxx.xx - no reply to our critical packet (see doc/sip-retransmit.txt).
WARNING[1229]: chan_sip.c:3807 retrans_pkt: Hanging up call xxxxxxxxxxx@xx.xx.xxx.xx - no reply to our critical packet (see doc/sip-retransmit.txt).
Manager.conf
[general]
enabled =yes
webenabled = yes
port = 5038
bindaddr = 0.0.0.0
displayconnects=yes
[manager]
secret=xxxxxx
permit=0.0.0.0/0.0.0.0 ;allow access to all only while I test
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config
I am using Asterisk 1.6.2.6 and
java version "1.7.0"
IcedTea Runtime Environment (build 1.7.0-b21)
IcedTea Client VM (build 1.7.0-b21, mixed mode)
My asterisk box works, I have tested it (incoming, outgoing calls, DID). Where have I gone wrong??