2
0

api.lua 648 B

123456789101112131415161718192021222324
  1. stream:write("Content-Type: text/html\n\n");
  2. stream:write("<title>FreeSWITCH Command Portal</title>");
  3. stream:write("<h2>FreeSWITCH Command Portal</h2>");
  4. stream:write("<form method=post><input name=command size=40> ");
  5. stream:write("<input type=submit value=\"Execute\">");
  6. stream:write("</form><hr noshade size=1><br>");
  7. command = env:getHeader("command");
  8. if (command) then
  9. api = freeswitch.API();
  10. reply = api:executeString(command);
  11. if (reply) then
  12. stream:write("<br><B>Command Result</b><br><pre>" .. reply .. "\n</pre>");
  13. end
  14. end
  15. env:addHeader("cool", "true");
  16. stream:write("<pre>" .. env:serialize() .. "</pre>");