Manager API connection error

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?

What error? All I see is INFO messages. OK. now I see it, but there is no useful information with it.

i would put some extra System.out.println() in there to see if you are even making it to the originate, or if there is an error at the logon().

originateAction settings seems to be wrong. Does Asterisk have log wher I can find some extra information?

just log into the console and crank the verbosity up. You should be able to see what’s happening under the hood. You can also add “debug” to the logger.conf “console” configuration.