简体   繁体   English

星号-click2call Java有效,但是需要2个步骤

[英]Asterisk - click2call Java works but takes 2 steps

I've implemented a Java method (using Asterisk-Java library) that initiates a call between two users. 我已经实现了Java方法(使用Asterisk-Java库),该方法可以在两个用户之间发起调用。 Alice is the caller and bob the receiver. 爱丽丝是呼叫者,鲍勃是接收者。 It works but I don't know why, it's doing it in 2 steps : 它可以工作,但我不知道为什么,它分两个步骤进行:

  1. Alice receives a call from herself. 爱丽丝接到她的电话。
  2. If Alice picks up the call then the call between her and Bob is launched. 如果爱丽丝接听电话,则她和鲍勃之间的呼叫将启动。 (= Alice has to click on "Accept the call" so that the call to Bob is eventually made. (=爱丽丝必须单击“接受呼叫”,才能最终呼叫鲍勃。

Any idea why Alice receives a call from herself first? 知道为什么爱丽丝首先会接到自己的电话吗?

Here's my code : 这是我的代码:

public void call(final String user, final String exten) throws IOException, AuthenticationFailedException, TimeoutException {
    OriginateAction originateAction;
    ManagerResponse originateResponse;

    originateAction = new OriginateAction();
    originateAction.setChannel("SIP/" + user);
    originateAction.setContext("work");
    originateAction.setExten(exten);
    originateAction.setPriority(new Integer(1));
    originateAction.setTimeout(new Long(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);

    // and finally log off and disconnect
    managerConnection.logoff();
}
originateAction.setChannel("SIP/" + user);

This action launched first. 该行动首先启动。

If you need other order, you shoudl do it other order. 如果需要其他命令,则应另做一个命令。

You can do dial via Local/ channel. 您可以通过本地/频道拨号。

This question was answered by me in last month 4 or 5 times. 这个问题在上个月被我回答了4到5次。

For more info see other similar questions. 有关更多信息,请参见其他类似问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM