Hi,
I have problem to run example from:
asterisk-java.org/development/tu … ager%20API
Here is Java code:
[code]
package manager;
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(
"192.168.142.133", "manager", "password");
this.managerConnection = factory.createManagerConnection();
}
public void run() throws IOException, AuthenticationFailedException,
TimeoutException
{
OriginateAction originateAction;
ManagerResponse originateResponse;
originateAction = new OriginateAction();
originateAction.setChannel("person1");
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]
Console output is:
2009-08-10 13:35:00 org.asteriskjava.manager.internal.ManagerConnectionImpl connect
INFO: Connecting to 192.168.142.133:5038
2009-08-10 13:35:00 org.asteriskjava.manager.internal.ManagerConnectionImpl setProtocolIdentifier
INFO: Connected via Asterisk Call Manager/1.0
2009-08-10 13:35:00 org.asteriskjava.manager.internal.ManagerConnectionImpl doLogin
INFO: Successfully logged in
2009-08-10 13:35:00 org.asteriskjava.manager.internal.ManagerConnectionImpl doLogin
INFO: Determined Asterisk version: Asterisk 1.4
Error
2009-08-10 13:35:00 org.asteriskjava.manager.internal.ManagerReaderImpl run
INFO: Terminating reader thread: No more lines available: null
2009-08-10 13:35:00 org.asteriskjava.manager.internal.ManagerConnectionImpl disconnect
INFO: Closing socket.
Asterisk manager.conf:
[general]
enabled = yes
webenabled = yes
port = 5038
bindaddr = 0.0.0.0
[manager]
secret=password
permit=0.0.0.0/0.0.0.0
read=system,call,log,verbose,agent,command,user
write=system,call,log,verbose,agent,command,user
Asterisk extensions.conf:
[default]
exten => 1300,1,Agi(agi://localhost/hello.agi)
exten => 1111,1,Dial(SIP/person1)
exten => 1111,2,Answer
exten => 2222,1,1Dial(SIP/person2)
exten => 2222,2,Answer
Any idea why do i get this error?