1

I have done outbound calls successfully using asterisk java with XLite software. This time I would like to make inbound calls without XLIte.

public class HelloManager
{
    private ManagerConnection managerConnection;

    public HelloManager() throws IOException
    {
        ManagerConnectionFactory factory = new ManagerConnectionFactory(
                "192.168.68.173","manager", "password12345");

        this.managerConnection = factory.createManagerConnection();
    }

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

        originateAction = new OriginateAction();
        originateAction.setChannel("SIP/1010");
        originateAction.setContext("default");
        originateAction.setExten("2020");
        originateAction.setPriority(new Integer(1));
        originateAction.setTimeout(new Integer(30000));
        originateAction.setAsync(true);
         // connect to Asterisk and log in
     try {
      managerConnection.login();
     }
     catch(Exception e)
     {
         System.out.println(e.toString());
     }



        // 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
        managerConnection.logoff();
    }

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

        helloManager = new HelloManager();
        helloManager.run();
    }
}

In above code 'originateResponse.getResponse()' function helps to intiate outbound calls.Do you have any idea about how we can implement inbound calls that has been originated by AMI?Is there any need of Asterisk AGI to making inbound calls?

SULFIKAR A N
  • 436
  • 4
  • 13

1 Answers1

0

If you are looking for inbound call with out xlite .You need to develop an sip client in java and make all the communication through that.

Otherwise if you are looking for getting information from asterisk(like answered time,starttime,status).Then you can achieve the same by AGI. In this case Xlite is your communication device but you are able to share the asterisk call related records with your java program

hks1233
  • 196
  • 1
  • 2
  • 8