From 27b289bd4b023c4df9a9c566c0f70e2b44692e59 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 23 Jun 2008 19:17:47 +0000 Subject: [PATCH] add example git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8827 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- scripts/api.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/api.lua diff --git a/scripts/api.lua b/scripts/api.lua new file mode 100644 index 0000000000..8f26ad83a5 --- /dev/null +++ b/scripts/api.lua @@ -0,0 +1,24 @@ +stream:write("Content-Type: text/html\n\n"); +stream:write("FreeSWITCH Command Portal"); +stream:write("

FreeSWITCH Command Portal

"); +stream:write("
"); +stream:write(""); +stream:write("


"); + +command = env:getHeader("command"); + +if (command) then + api = freeswitch.API(); + reply = api:executeString(command); + + if (reply) then + stream:write("
Command Result
" .. reply .. "\n
"); + end + +end + +env:addHeader("cool", "true"); +stream:write("
" .. env:serialize() .. "
"); + + +