JavaScript application is not working in Freeswitch
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开发者_JAVA百科");
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.
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".
精彩评论