2008-09-10 10:05:48 -04:00
|
|
|
function all_done(s, how)
|
2009-02-18 16:06:36 -05:00
|
|
|
freeswitch.console_log("info", "done: " .. how .. "\n");
|
2008-09-10 10:05:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
function my_cb(s, type, obj, arg)
|
|
|
|
if (arg) then
|
2009-02-18 16:06:36 -05:00
|
|
|
freeswitch.console_log("info", "\ntype: " .. type .. "\n" .. "arg: " .. arg .. "\n");
|
2008-09-10 10:05:48 -04:00
|
|
|
else
|
2009-02-18 16:06:36 -05:00
|
|
|
freeswitch.console_log("info", "\ntype: " .. type .. "\n");
|
2008-09-10 10:05:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
if (type == "dtmf") then
|
2009-02-18 16:06:36 -05:00
|
|
|
freeswitch.console_log("info", "\ndigit: [" .. obj['digit'] .. "]\nduration: [" .. obj['duration'] .. "]\n");
|
2008-09-10 10:05:48 -04:00
|
|
|
|
|
|
|
|
2009-02-17 16:50:50 -05:00
|
|
|
if (obj['digit'] == "1") then
|
2009-02-18 16:06:36 -05:00
|
|
|
--session:speak("seek backwards");
|
|
|
|
return "seek:-9000";
|
2008-09-10 10:05:48 -04:00
|
|
|
end
|
|
|
|
|
2009-02-23 19:29:12 -05:00
|
|
|
if (obj['digit'] == "2") then
|
|
|
|
--session:speak("start over");
|
|
|
|
return "seek:0";
|
|
|
|
end
|
|
|
|
|
2008-09-10 10:05:48 -04:00
|
|
|
if (obj['digit'] == "3") then
|
2009-02-18 16:06:36 -05:00
|
|
|
--session:speak("seek forward");
|
|
|
|
return "seek:+9000";
|
2008-09-10 10:05:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
if (obj['digit'] == "4") then
|
2009-02-18 16:06:36 -05:00
|
|
|
--session:speak("speed faster");
|
2009-02-17 16:50:50 -05:00
|
|
|
return "speed:+1";
|
2008-09-10 10:05:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
if (obj['digit'] == "5") then
|
2009-02-18 16:06:36 -05:00
|
|
|
--session:speak("speed normal");
|
2009-02-17 16:50:50 -05:00
|
|
|
return "speed:0";
|
2008-09-10 10:05:48 -04:00
|
|
|
end
|
2009-02-17 16:50:50 -05:00
|
|
|
|
2008-09-10 10:05:48 -04:00
|
|
|
if (obj['digit'] == "6") then
|
2009-02-18 16:06:36 -05:00
|
|
|
--session:speak("speed slower");
|
2009-02-17 16:50:50 -05:00
|
|
|
return "speed:-1";
|
2008-09-10 10:05:48 -04:00
|
|
|
end
|
2009-02-17 16:50:50 -05:00
|
|
|
|
2008-09-10 10:05:48 -04:00
|
|
|
if (obj['digit'] == "7") then
|
2009-02-18 16:06:36 -05:00
|
|
|
--session:speak("volume up");
|
2009-02-17 16:50:50 -05:00
|
|
|
return "volume:+1";
|
2008-09-10 10:05:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
if (obj['digit'] == "8") then
|
2009-02-18 16:06:36 -05:00
|
|
|
--session:speak("volume normal");
|
2009-02-17 16:50:50 -05:00
|
|
|
return "volume:0";
|
2008-09-10 10:05:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
if (obj['digit'] == "9") then
|
2009-02-18 16:06:36 -05:00
|
|
|
--session:speak("volume down");
|
2009-02-17 16:50:50 -05:00
|
|
|
return "volume:-1";
|
|
|
|
end
|
|
|
|
|
|
|
|
if (obj['digit'] == "*") then
|
2009-02-18 16:06:36 -05:00
|
|
|
--session:speak("stop");
|
2009-02-17 16:50:50 -05:00
|
|
|
return "stop";
|
|
|
|
end
|
|
|
|
|
|
|
|
if (obj['digit'] == "0") then
|
2009-02-18 16:06:36 -05:00
|
|
|
--session:speak("pause");
|
2009-02-17 16:50:50 -05:00
|
|
|
return "pause";
|
|
|
|
end
|
|
|
|
|
|
|
|
if (obj['digit'] == "#") then
|
2008-09-10 10:05:48 -04:00
|
|
|
return "break";
|
|
|
|
end
|
2009-02-17 16:50:50 -05:00
|
|
|
|
2008-09-10 10:05:48 -04:00
|
|
|
else
|
2009-02-18 16:06:36 -05:00
|
|
|
freeswitch.console_log("info", obj:serialize("xml"));
|
2008-09-10 10:05:48 -04:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
blah = "args";
|
2009-02-18 16:06:36 -05:00
|
|
|
---session:set_tts_parms("flite", "kal");
|
2008-09-10 10:05:48 -04:00
|
|
|
session:setHangupHook("all_done");
|
|
|
|
session:setInputCallback("my_cb", "blah");
|
2009-02-17 16:50:50 -05:00
|
|
|
session:streamFile("/ram/swimp.raw");
|
2009-02-18 16:06:36 -05:00
|
|
|
--session:speak("Thank you, good bye!");
|