views:

20

answers:

1

Hi all, I am learning freeswitch applications.In this the application called 'javascript' which is used to execute our java scripts.

I have created the following java script.

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.

Someone help me in this.

Thanks in advance.

+1  A: 

Hello, 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".

Lallo