[Asterisk-java-users] run originateAction from a jsp
Brought to you by:
srt
From: g f <gf...@gm...> - 2006-01-12 22:30:23
|
Hello all, I am trying to run the following by calling it from a jsp. The code below worksfine if I include a main and run it as an executable. I= s this doable or do I need to rethink my code. Is it possible to create on method from the code below and call that method only(include the connection in the run method)? Thanks. public class Test { private ManagerConnection managerConnection; private String CHANNEL =3D "SIP/201"; //channel that will initiate private String DATA =3D "SIP/202"; //channel that the initiater wil= l call private String CALLERID =3D "22222"; //set the caller id public Test() throws IOException { ManagerConnectionFactory factory =3D new ManagerConnectionFactory(= ); this.managerConnection =3D factory.getManagerConnection("135.119.1= 1.1 ", "manager", "pa55w0rd"); } public void run(String channel, String data) throws IOException, AuthenticationFailedException, TimeoutException { OriginateAction originateAction; ManagerResponse originateResponse; //set vars for dialing from one sip to another originateAction =3D new OriginateAction(); originateAction.setChannel(channel); originateAction.setApplication("dial"); originateAction.setActionId("dufus"); originateAction.setData(data); originateAction.setCallerId(CALLERID); originateAction.setPriority(new Integer(1)); originateAction.setTimeout(new Integer(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 =3D managerConnection.sendAction(originateAction= , 30000); // and finally log off and disconnect managerConnection.logoff(); } |