提交 49fa3172 authored 作者: Brian West's avatar Brian West

Start the documents on mod_spidermonkey.



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@764 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 dcb652ad
Session Methods
=======================================
session.streamFile
Usage:
session.streamFile(file, timer, callback);
file = Path to the file to play (ie /tmp/file.wav)
timer = Timer to use for async mode. (optional)
callback = Which function to fire when a dtmf digit is pressed. (optional)
Callback return values and meanings:
seek:ms - +1000 or -1000 will seek 1000ms forward or backwards, seek 0 will start the file over.
speed: - +1,-1 or 0 for normal speed. (valid ranges are +1,+2, 0 or -1,-2)
pause: - toggles pause and play modes on the file.
You can also return arbitrary values and act on them as you
wish. In our example we return "hangup" when the caller
press the * key on the keypad.
Example:
function on_dtmf(digits)
{
if (digits == "3") {
return "seek:+1000";
}
if (digits == "1") {
return "seek:-1000";
}
if (digits == "*") {
return "hangup";
}
}
session.answer();
while(session.state == "CS_EXECUTE") {
allDigits = "";
return_value = session.streamFile("/tmp/demo.wav", "", "on_dtmf");
if (return_value == "hangup") {
session.hangup(); // or break;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论