| Server IP : 189.126.111.107 / Your IP : 216.73.217.69 Web Server : Apache System : Linux www.gadotticar.com.br 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 User : gadotticar ( 1000) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/src/freeswitch-1.10.12/scripts/lua/ |
Upload File : |
local count = 0;
local tddstring = {};
function my_cb(s, type, obj, arg)
if (arg) then
freeswitch.console_log("info", "\ntype: " .. type .. "\n" .. "arg: " .. arg .. "\n");
else
freeswitch.console_log("info", "\ntype: " .. type .. "\n");
end
tdddata = obj:getHeader("TDD-Data");
count = 0;
table.insert(tddstring, tdddata);
freeswitch.console_log("info", obj:serialize("xml"));
end
function all_done(s, how)
freeswitch.console_log("info", "done: " .. how .. "\n");
end
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
blah = "args";
session:setHangupHook("all_done");
session:setInputCallback("my_cb", "blah");
session:answer();
session:execute("playback", "silence_stream://2000");
session:execute("spandsp_detect_tdd");
session:execute("spandsp_send_tdd", "Welcome to FreeSWITCH");
while session:ready() do
session:streamFile("silence_stream://10000");
if (count > 0) then
count = 0;
if (tablelength(tddstring) > 0) then
session:execute("spandsp_send_tdd", "You said: " .. table.concat(tddstring));
tddstring = {};
end
end
count = count + 1;
end