There java class that executes and returns the result
package Test;
import static java.lang.System.out;
import java.util.ArrayList;
import java.util.List;
import org.asteriskjava.manager.ManagerConnection;
import org.asteriskjava.manager.ManagerConnectionFactory;
import org.asteriskjava.manager.action.CommandAction;
import org.asteriskjava.manager.response.CommandResponse;
public class Manager
{
private ManagerConnection c;
public Manager() throws Exception
{
ManagerConnectionFactory factory = new ManagerConnectionFactory(
"tttt", "admin", "ttt");
c = factory.createManagerConnection();
}
public void run() throws Exception
{
c.login();
CommandAction action;
CommandResponse response;
List<String> list = new ArrayList<String>();
action = new CommandAction();
action.setCommand(" sip show peers");
response = (CommandResponse) c.sendAction(action);
list = response.getResult();
for (String s : list) {
if (s.contains("VOIP")) {
out.print(s);
}
}
c.logoff();
}
public static void main(String[] args) throws Exception
{
new Manager().run();
}
}
The result of :
TEST 172.28.1.1 a 5060 OK (4 ms) tes 172.28.1.1 a 5060 OK (2 ms) at Test.Manager.main(Manager.java:50)
Java Result: 1
jsp:
<%@page import="Test.Manager" %>
<%
Manager o = new Manager();
o.run();
out.print(o);
%>
When you call the JSP in the browser , I see that the code is executed ( It is evident that he Rushed to the server and received data ) but on the page in the browser does not display the result of execution. Tell me which way to dig.