I've implemented a Java method (using Asterisk-Java library) that initiates a call between two users. Alice is the caller and bob the receiver. It works but I don't know why, it's doing it in 2 steps :
- Alice receives a call from herself.
- 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();
}
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.
For more info see other similar questions.