Hello,
I am having the same issue, even thought I took in consideration all your remarks, I still get the Error in originateResponse.getResponse().
The manager successfully logged to Asterisk, but nothing happens apart from the Error.
Here is my code :
Java (eclipse)
[code]package gomobile.com.telintel;
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 call() throws IOException, AuthenticationFailedException, TimeoutException {
OriginateAction originateAction;
ManagerResponse originateResponse;
originateAction = new OriginateAction();
originateAction.setChannel("SIP/1000");
originateAction.setContext("default");
originateAction.setExten("1001");
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 = new HelloManager();
helloManager.call();
}
}[/code]
sip.conf
[general]
context=default
bindport=5060
disallow=all
allow=ulaw
allow=alaw
[1000]
type=friend
host=dynamic
secret=1234
context=default
[1001]
type=friend
host=dynamic
secret=1234
context=default
[1002]
type=friend
host=dynamic
secret=1234
context=default
extensions.conf
[general]
static=yes
writeprotect=no
[default]
exten => 1001,1,Answer()
exten => 1001,n,Dial(SIP/1001,20,tr)
exten => 1001,n,Hangup
exten => 1515,1,Verbose(2,Hello)
exten => 1002,1,Answer()
exten => 1002,n,Dial(SIP/1002,20,tr)
exten => 1002,n,Hangup
exten => 555,1,Answer()
exten => 555,n,Playback(tt-monkeys)
exten => 555,n,Hangup
exten => 666,1,Playback(thank-you-cooperation)
exten => 666,n,Hangup()
exten => 888,1,Agi(agi://localhost/hello.agi)
exten => 999,1,Agi(agi://localhost/hello2.agi)
exten => 999,n,Verbose(2,The channel name is ${MYVAR})
exten => 999,n,Playback(thank-you-cooperation)
exten => 999,n,Hangup()
exten => h,1,Verbose(2,Hang-> The channel name is ${MYVAR})
exten => t,1,Verbose(2,timeout t)
exten => T,1,Verbose(2,timeout T)
exten => i,1,Verbose(2,timeout T)
What I get in Eclipse console
Dec 12, 2014 8:05:23 PM org.asteriskjava.manager.internal.ManagerConnectionImpl connect
INFO: Connecting to localhost:5038
Dec 12, 2014 8:05:23 PM org.asteriskjava.manager.internal.ManagerConnectionImpl setProtocolIdentifier
INFO: Connected via Asterisk Call Manager/2.5.0
Dec 12, 2014 8:05:23 PM org.asteriskjava.manager.internal.ManagerConnectionImpl setProtocolIdentifier
WARNING: Unsupported protocol version 'Asterisk Call Manager/2.5.0'. Use at your own risk.
Dec 12, 2014 8:05:23 PM org.asteriskjava.manager.internal.ManagerConnectionImpl doLogin
INFO: Successfully logged in
Dec 12, 2014 8:05:23 PM org.asteriskjava.manager.internal.EventBuilderImpl buildEvent
INFO: No event class registered for event type 'fullybooted', attributes: {status=Fully Booted, event=FullyBooted, privilege=system,all}
Dec 12, 2014 8:05:25 PM org.asteriskjava.manager.internal.ManagerConnectionImpl doLogin
INFO: Determined Asterisk version: Asterisk 1.0
Error
Dec 12, 2014 8:05:25 PM org.asteriskjava.manager.internal.ManagerConnectionImpl disconnect
INFO: Closing socket.
Please help