[Freeswitch-users] Plz Help me! How to capture a session events by setInputCallback ?

Чистяков Иван chistyakov at directtel.ru
Wed Mar 30 09:17:48 MSD 2011


This script is work, but only for DTMF.


function my_cb(s, type, obj, arg)

     if (arg) then
        print("type: " .. type .. "\n" .. "arg: " .. arg .. "\n");
     else
        print("type: " .. type .. "\n");
     end

     if (type == "dtmf") then
        print("digit: [" .. obj['digit'] .. "]\nduration: [" ..
obj['duration'] .. "]\n");
     else
        print(obj:serialize("xml"));

     end
return true
end

blah="w00t";
$

local session = freeswitch.Session("sofia/internal/Dt002%172.16.0.49");
session:answer();
session:execute("enable_heartbeat", 5);
session:setInputCallback("my_cb", "blah");
session:streamFile("/tmp/1.wav");





More information about the FreeSWITCH-users mailing list