forked from signalwire/freeswitch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcallback.lua
More file actions
86 lines (68 loc) · 1.97 KB
/
Copy pathcallback.lua
File metadata and controls
86 lines (68 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
function all_done(s, how)
freeswitch.console_log("info", "done: " .. how .. "\n");
end
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
if (type == "dtmf") then
freeswitch.console_log("info", "\ndigit: [" .. obj['digit'] .. "]\nduration: [" .. obj['duration'] .. "]\n");
if (obj['digit'] == "1") then
--session:speak("seek backwards");
return "seek:-9000";
end
if (obj['digit'] == "2") then
--session:speak("start over");
return "seek:0";
end
if (obj['digit'] == "3") then
--session:speak("seek forward");
return "seek:+9000";
end
if (obj['digit'] == "4") then
--session:speak("speed faster");
return "speed:+1";
end
if (obj['digit'] == "5") then
--session:speak("speed normal");
return "speed:0";
end
if (obj['digit'] == "6") then
--session:speak("speed slower");
return "speed:-1";
end
if (obj['digit'] == "7") then
--session:speak("volume up");
return "volume:+1";
end
if (obj['digit'] == "8") then
--session:speak("volume normal");
return "volume:0";
end
if (obj['digit'] == "9") then
--session:speak("volume down");
return "volume:-1";
end
if (obj['digit'] == "*") then
--session:speak("stop");
return "stop";
end
if (obj['digit'] == "0") then
--session:speak("pause");
return "pause";
end
if (obj['digit'] == "#") then
return "break";
end
else
freeswitch.console_log("info", obj:serialize("xml"));
end
end
blah = "args";
---session:set_tts_parms("flite", "kal");
session:setHangupHook("all_done");
session:setInputCallback("my_cb", "blah");
session:streamFile("/ram/swimp.raw");
--session:speak("Thank you, good bye!");