1

XLite ソフトウェアでアスタリスク Java を使用して、アウトバウンド コールを正常に実行しました。今回は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();
    }
}

上記のコードの「originateResponse.getResponse()」関数は、アウトバウンド コールを開始するのに役立ちます。AMI によって発信されたインバウンド コールを実装する方法について何か考えがありますか?インバウンド コールを行うためにアスタリスク AGI が必要ですか?

4

1 に答える 1