Manager API connection error

I have problem to run example from: … ager%20API

Here is Java code:

package manager;

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(
            "", "manager", "password");

    this.managerConnection = factory.createManagerConnection();

public void run() throws IOException, AuthenticationFailedException,
    OriginateAction originateAction;
    ManagerResponse originateResponse;

    originateAction = new OriginateAction();
    originateAction.setPriority(new Integer(1));
    originateAction.setTimeout(new Integer(30000));

    // connect to Asterisk and log in

    // 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

    // and finally log off and disconnect

public static void main(String[] args) throws Exception
    HelloManager helloManager;

    helloManager = new HelloManager();;


Console output is:

2009-08-10 13:35:00 org.asteriskjava.manager.internal.ManagerConnectionImpl connect INFO: Connecting to 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:

enabled = yes
webenabled = yes
port = 5038
bindaddr =


Asterisk extensions.conf:

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.