[Freeswitch-users] Javascript Quickstart page not as "quick" as it could be

mszlazak at aol.com mszlazak at aol.com
Mon Oct 27 23:58:10 PDT 2008


I got FreeSwitch running today and connected a softphone to it. Yippee!







But ran into some snags trying out Javascript within a dialplan.







My FreeSwitch is running on Windows XP and from the same machine I use
an X-Lite softphone to call and play around while learning how
Javascript and FreeSwitch work together.







The first snag was the location of the default dialplan file given in the "Quickstart" (http://wiki.freeswitch.org/wiki/Javascript_QuickStart). It
is "conf\dialplan\default.xml" on my system and not as the "Quickstart
says in "conf/default_context" since "default_context" does not exist.?
?







Next, trying the JavaScript Quickstart HelloWorld.js example, I get the
following errors which indicate a different location is needed for the
.wav file from what the "Quickstart" says and this also requires two
more new folders (sound & en) nested inside folder callie. Now,
either I did something wrong or the instructions need more updating.



???? ?



2008-10-27 22:34:16 [INFO] mod_dialplan_xml.c:228 dialplan_hunt() Processing FreeSwitch->8337 in context default



2008-10-27 22:34:16 [NOTICE] mod_spidermonkey.c:2034 session_answer() Channel [sofia/internal/1000 at 10.0.0.2] has been answered



2008-10-27 22:34:16 [ERR] mod_sndfile.c:175 sndfile_file_open() Error
Opening File [C:\Program
Files\FreeSWITCH/sounds/en/us/callie\sound/en/HelloWorld



.wav] [System error : The system cannot find the path specified.



]



2008-10-27 22:34:16 [ERR] HelloWorld.js:6 mod_spidermonkey()? TypeError: callBack is not a function



2008-10-27 22:34:16 [NOTICE] switch_core_state_machine.c:157 switch_core_standard_on_execute() Hangup sofia/internal/1000 at 10.0.0.2 [CS_EXECUTE] [NORMAL



_CLEARING]



2008-10-27 22:34:16 [NOTICE] switch_core_session.c:812 switch_core_session_thread() Session 3 (sofia/internal/1000 at 10.0.0.2) Ended



2008-10-27 22:34:16 [NOTICE] switch_core_session.c:814 switch_core_session_thread() Close Channel sofia/internal/1000 at 10.0.0.2 [CS_HANGUP]











I suppose I could have not used variables "languageCode" and "soundDir"
but I decided to create the two new folders and placed the .wav file in
folder "en" (C:\Program
Files\FreeSWITCH/sounds/en/us/callie\sound/en/HelloWorld.wav). 







Also, I removed the arguments 'callBack' and 'callBackArgs' from
'session.streamFile(soundDir + languageCode + "/" + fileName, callBack,
callBackArgs);'. 



Otherwise, I would get the following error:







2008-10-27 22:58:08 [ERR] HelloWorld.js:6 mod_spidermonkey()? TypeError: callBack is not a function







This gives me an updated HelloWorld.js file that looks like this:







var languageCode = "en";



var soundDir = "sound/";







function playFile(fileName, callBack, callBackArgs)



{



?? ?session.streamFile(soundDir + languageCode +? "/" + fileName);



}







session.answer();



playFile("HelloWorld.wav");



exit();







The command line interface gave the following and I finally heard my HelloWorld.wav file :-)







2008-10-27 23:02:59 [NOTICE] switch_channel.c:538 switch_channel_set_name() New Channel sofia/internal/1000 at 10.0.0.2 [056e90b9-e49a-d544-8076-573fbeb50



9f3]



2008-10-27 23:02:59 [INFO] mod_dialplan_xml.c:228 dialplan_hunt() Processing FreeSwitch->8337 in context default



2008-10-27 23:02:59 [NOTICE] mod_spidermonkey.c:2034 session_answer() Channel [sofia/internal/1000 at 10.0.0.2] has been answered



2008-10-27 23:03:10 [NOTICE] switch_core_state_machine.c:157 switch_core_standard_on_execute() Hangup sofia/internal/1000 at 10.0.0.2 [CS_EXECUTE] [NORMAL



_CLEARING]



2008-10-27 23:03:10 [NOTICE] switch_core_session.c:812 switch_core_session_thread() Session 9 (sofia/internal/1000 at 10.0.0.2) Ended



2008-10-27 23:03:10 [NOTICE] switch_core_session.c:814 switch_core_session_thread() Close Channel sofia/internal/1000 at 10.0.0.2 [CS_HANGUP]











However, the sound has was quite static filled. 



What's the cause of all that static and how do I fix (remove) it?







Thanks. Mark.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20081028/ce6413f5/attachment-0002.html 


More information about the FreeSWITCH-users mailing list