[Freeswitch-users] jitter buffer effecting input callback in lua
Tom Carlson
tom at tomcarlson.com
Sun Jan 3 12:31:35 PST 2010
I have a very simple lua script (shown below my message)
This script plays a greeting, lets the caller record a message, detecting
when caller is done by sensing a keypress. It then plays the message back
to the caller.
This works perfectly, except the audio quality of the recorded message is
less than I had hoped. To try to fix this, I have added a line to activate
the jitter buffer. This single line keeps the script from detecting the
dtmf tones that end the recording, so the script just stays locked in record
mode forever, until you hang up.
The log shows no problems.
How can I activate the jitter buffer, and still detect dtmf events?
Thanks for your help.
Tom
-- ---------------------------------------------------------------------
function key_press(session, input_type, data, args)
if input_type == "dtmf" then
freeswitch.consoleLog("info", "Key pressed: " .. data["digit"])
return "break"
end
end
session:setVariable("jitterbuffer_msec", "200");
if session:ready() then
session:answer();
while (session:ready() == true) do
session:setAutoHangup(false);
session:sleep(1000);
session:streamFile("/usr/local/freeswitch/sounds/en/us/callie/voicemail/8000/vm-record_message.wav");
session:setInputCallback("key_press", "");
session:recordFile("/tmp/blah.wav", 5000, 10, 10); -- pressing key ends
the recording
session:streamFile("/tmp/blah.wav");
end
end
--
--------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100103/c171fe76/attachment-0002.html
More information about the FreeSWITCH-users
mailing list