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/[EMAIL PROTECTED] 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/[EMAIL PROTECTED] 
[CS_EXECUTE] [NORMAL



_CLEARING]



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



2008-10-27 22:34:16 [NOTICE] switch_core_session.c:814 
switch_core_session_thread() Close Channel sofia/internal/[EMAIL PROTECTED] 
[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/[EMAIL PROTECTED] [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/[EMAIL PROTECTED] has been answered



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



_CLEARING]



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



2008-10-27 23:03:10 [NOTICE] switch_core_session.c:814 
switch_core_session_thread() Close Channel sofia/internal/[EMAIL PROTECTED] 
[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.
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

Reply via email to