Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Labels:None
-
Environment:OS X & Centos 5,2
Description
I tried to use the recordFile as explained in the example, and because of the comment in the example, I assumed that the # would stop recording without additional commands:
session:answer();
session:recordFile("/tmp/blah.wav", 30000, 10, 10); -- pressing # ends the recording
session:streamFile("/tmp/blah.wav");
session:hangup();
That did not work. Initially I thought it was a bug, but after reviewing some other examples in javascript and python I realized that I needed to define an InputCallback function. Indeed that worked:
function onInput(s, type, obj)
if (type == "dtmf" and obj['digit'] == '#') then
return "break";
end
end
session:answer();
session:setInputCallback("onInput", "");
session:recordFile("/tmp/blah.wav", 30000, 10, 10); -- pressing # ends the recording
session:streamFile("/tmp/blah.wav");
session:hangup();
session:answer();
session:recordFile("/tmp/blah.wav", 30000, 10, 10); -- pressing # ends the recording
session:streamFile("/tmp/blah.wav");
session:hangup();
That did not work. Initially I thought it was a bug, but after reviewing some other examples in javascript and python I realized that I needed to define an InputCallback function. Indeed that worked:
function onInput(s, type, obj)
if (type == "dtmf" and obj['digit'] == '#') then
return "break";
end
end
session:answer();
session:setInputCallback("onInput", "");
session:recordFile("/tmp/blah.wav", 30000, 10, 10); -- pressing # ends the recording
session:streamFile("/tmp/blah.wav");
session:hangup();
Thanks,
Brian