JavaScript 应用程序无法在 Freeswitch 中运行
我正在学习 FreeSWITCH 应用程序。在此应用程序称为“javascript”,用于执行 JavaScript。
我创建了以下 JavaScript:
var languageCode = "en";
var soundDir = "sound/";
function playFile(fileName, callBack, callBackArgs)
{
session.streamFile(soundDir + languageCode + "/" + fileName, callBack, callBackArgs);
}
session.answer();
playFile("HelloWorld.wav");
exit()
然后我使用 fs_cli 中的 jsrun API 运行此脚本。 但它给出了错误,因为“session.answer”不是一个函数。
I am learning FreeSWITCH applications. In this the application called 'javascript' which is used to execute our JavaScript.
I have created the following JavaScript:
var languageCode = "en";
var soundDir = "sound/";
function playFile(fileName, callBack, callBackArgs)
{
session.streamFile(soundDir + languageCode + "/" + fileName, callBack, callBackArgs);
}
session.answer();
playFile("HelloWorld.wav");
exit()
Then I have run this script using jsrun API in fs_cli.
but it has given the error as 'session.answer' is not a function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您误解了“session.answer()”的含义。
谁会在这里听你的HelloWorld.wav?
如果您像这样使用“jsrun”,那么最好由 freeswitch 拨出,因为它没有要应答的会话。
另请遵循本示例中有关拨号方案的最后部分:
http://wiki.freeswitch.org/wiki/Javascript_QuickStart
此示例不与“jsrun”一起使用。
I think you are misunderstanding the meaning of "session.answer()".
Who is going to listen your HelloWorld.wav here?
If you use "jsrun" like this it's better if freeswitch dials out because it has no session to answer.
Follow also the last part of this example concerning the dialplan:
http://wiki.freeswitch.org/wiki/Javascript_QuickStart
This example is not to be used with "jsrun".