want to send a call using java and play a audio file using Asterisk

alex0r
Joined: Tue 16 of Jun, 2015

Re: want to send a call using java and play a audio file using Asterisk

Posted:Tue 21 of Jul, 2015 (07:59 UTC)
Hello!


My name is Alex Michel, you may be interested in the next product.

GoAntiFraud (https://goantifraud.com) is a complete solution to manage GoIP equipment more effectively.

It can be achieved by the fact that GoAntiFraud offers:

SIM cards rotation according to the large number of options;
Full automation of the majority of routine processes;
Dealing with USSD requests;
Automated work with SMS traffic;
Simulation of human behavior in GSM networks;
Banding SIM cards in groups to imitate calls on ‘favorite numbers’;
Implementation of daily and weekly cycles of human behavior;
Wide call routing functionality.


And much more, that you can learn from me if you use contacts listed below. Or you can find more information on the website: https://goantifraud.com.

Best regards,
Alex Michel,
E-mail: alex@goantifraud.com
Skype: alex.michel1989
Phone: +1 202 864 1191
https://goantifraud.com



Get richer with every minute
GoAntiFraud!!
bappy12
Joined: Thu 04 of Jun, 2015

want to send a call using java and play a audio file using Asterisk

Posted:Thu 04 of Jun, 2015 (11:12 UTC)
import java.io.*;
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.RedirectAction;
import org.asteriskjava.manager.response.ManagerResponse;

public class TestOriginate {

/**
  • @param args
  • /
private ManagerConnection managerConnection;

public TestOriginate() throws IOException {
ManagerConnectionFactory factory = new ManagerConnectionFactory(
"192.168.3.2", "bappy", "b007");

this.managerConnection = factory.createManagerConnection();

}
public void run() {
RedirectAction redirectAction;
ManagerResponse originateResponse;
String state = "";
String receiver = "01727571881";
redirectAction = new RedirectAction();
redirectAction.setContext("default");
redirectAction.setExten("101");
redirectAction.setPriority(new Integer(1));
redirectAction.setChannel("SIP/"+ receiver);
try {
System.out.println("Starting login 192.168.3.2");
managerConnection.login();

System.out.println("After login 192.168.3.2");

} catch (IllegalStateException e) {

} catch (TimeoutException e) {

} catch (IOException e) {

} catch (AuthenticationFailedException e) {

}
try {
originateResponse = managerConnection.sendAction(redirectAction,30000);
state = originateResponse.getResponse();
System.out.println("State value is :" + state);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (TimeoutException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

managerConnection.logoff();
}

public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub

TestOriginate test = new TestOriginate();
test.run();
}

}