[Freeswitch-users] How to capture an events by setInputCallback ?

Чистяков Иван chistyakov at directtel.ru
Tue Mar 29 10:27:28 MSD 2011


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");

This script is work, but only for DTMF.




More information about the FreeSWITCH-users mailing list