Asterisk 11 outbound calls using AMI with java

Hi ,
I would like to initiate a call from extension number to another in LAN network. I have done this task through FreePBX GUI. Now I am trying to execute this task by using Asterisk AMI with java code. Below java code shows some exception while in debugging.


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(
“”, “admin”, “admin”);

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
System.out.println(“Enter Response=”+originateResponse.getResponse());

// and finally log off and disconnect

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

helloManager = new HelloManager();;
} [/code]
Feb 06, 2014 4:04:16 PM org.asteriskjava.manager.internal.ManagerConnectionImpl connect
INFO: Connecting to
Feb 06, 2014 4:04:17 PM org.asteriskjava.manager.internal.ManagerConnectionImpl setProtocolIdentifier
INFO: Connected via Asterisk Call Manager/1.3
Feb 06, 2014 4:04:17 PM org.asteriskjava.manager.internal.ManagerConnectionImpl setProtocolIdentifier
WARNING: Unsupported protocol version ‘Asterisk Call Manager/1.3’. Use at your own risk.
Feb 06, 2014 4:04:18 PM org.asteriskjava.manager.internal.ManagerConnectionImpl disconnect
INFO: Closing socket.
Feb 06, 2014 4:04:18 PM org.asteriskjava.manager.internal.ManagerReaderImpl run
INFO: Terminating reader thread: No more lines available: null
Exception in thread “main” org.asteriskjava.manager.AuthenticationFailedException: Authentication failed
at org.asteriskjava.manager.internal.ManagerConnectionImpl.doLogin(
at org.asteriskjava.manager.internal.ManagerConnectionImpl.login(
at org.asteriskjava.manager.internal.ManagerConnectionImpl.login(
at org.asteriskjava.manager.DefaultManagerConnection.login(
at asteriskjtapi.HelloManager.main(
pls help me to complete this task
Here I am using the credentials in FreePBX. Is this right one to access ConnectionManager?
Please help me to complete this task

Check the acl for your manager user.