[Freeswitch-users] using keypress to stop a recording.
Wes
wes-fs at 499x.com
Thu Jun 16 22:54:52 MSD 2011
I'm using the following script to record, and I"m hoping to take a user
keypress to trigger the end of the recording and then play it back:
(the problem is that it stops on ANY keypress, while it seems like it
should only break on a "#" keypress)
I found this example at:
http://wiki.freeswitch.org/wiki/Mod_lua#session:recordFile
local numberToCall = 1234
local session = freeswitch.Session("sofia/xxx.xxx.xxx.xxx/"..numberToCall);
session:set_tts_parms("flite", "kal");
session:speak("Thank you for using my recording service, press the pound
key to stop the recording." );
function onInput(s, type, obj)
if (type == "dtmf" and obj['digit'] == '#') then
return "break";
end
end
session:setInputCallback("onInput", "");
session:recordFile("/tmp/luatest.wav");
freeswitch.consoleLog("info", "recording stopped by user keypress \n");
session:speak("your voicehas been recorded, i will play it for you now");
session:streamFile("/tmp/luatest.wav");
session:speak("that's it, goodbye.");
freeswitch.consoleLog("info", "hanging up... \n");
session:hangup();
More information about the FreeSWITCH-users
mailing list