<font face="Arial, Helvetica, sans-serif">I got FreeSwitch running today and connected a softphone to it. Yippee!<br>
<br>
But ran into some snags trying out Javascript within a dialplan.<br>
<br>
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.<br>
<br>
The first snag was the location of the default dialplan file given in the "Quickstart" </font><font face="Arial, Helvetica, sans-serif">(http://wiki.freeswitch.org/wiki/Javascript_QuickStart). </font><font face="Arial, Helvetica, sans-serif">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.
<br>
<br>
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.<br>
<br>
2008-10-27 22:34:16 [INFO] mod_dialplan_xml.c:228 dialplan_hunt() Processing FreeSwitch->8337 in context default<br>
2008-10-27 22:34:16 [NOTICE] mod_spidermonkey.c:2034 session_answer() Channel [sofia/internal/<a href="mailto:1000@10.0.0.2">1000@10.0.0.2</a>] has been answered<br>
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<br>
.wav] [System error : The system cannot find the path specified.<br>
]<br>
2008-10-27 22:34:16 [ERR] HelloWorld.js:6 mod_spidermonkey() TypeError: callBack is not a function<br>
2008-10-27 22:34:16 [NOTICE] switch_core_state_machine.c:157 switch_core_standard_on_execute() Hangup sofia/internal/<a href="mailto:1000@10.0.0.2">1000@10.0.0.2</a> [CS_EXECUTE] [NORMAL<br>
_CLEARING]<br>
2008-10-27 22:34:16 [NOTICE] switch_core_session.c:812 switch_core_session_thread() Session 3 (sofia/internal/<a href="mailto:1000@10.0.0.2">1000@10.0.0.2</a>) Ended<br>
2008-10-27 22:34:16 [NOTICE] switch_core_session.c:814 switch_core_session_thread() Close Channel sofia/internal/<a href="mailto:1000@10.0.0.2">1000@10.0.0.2</a> [CS_HANGUP]<br>
<br>
<br>
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). <br>
<br>
Also, I removed the arguments 'callBack' and 'callBackArgs' from
'session.streamFile(soundDir + languageCode + "/" + fileName, callBack,
callBackArgs);'. <br>
Otherwise, I would get the following error:<br>
<br>
2008-10-27 22:58:08 [ERR] HelloWorld.js:6 mod_spidermonkey() TypeError: callBack is not a function<br>
<br>
This gives me an updated HelloWorld.js file that looks like this:<br>
<br>
var languageCode = "en";<br>
var soundDir = "sound/";<br>
<br>
function playFile(fileName, callBack, callBackArgs)<br>
{<br>
session.streamFile(soundDir + languageCode + "/" + fileName);<br>
}<br>
<br>
session.answer();<br>
playFile("HelloWorld.wav");<br>
exit();<br>
<br>
The command line interface gave the following and I finally heard my HelloWorld.wav file :-)<br>
<br>
2008-10-27 23:02:59 [NOTICE] switch_channel.c:538 switch_channel_set_name() New Channel sofia/internal/<a href="mailto:1000@10.0.0.2">1000@10.0.0.2</a> [056e90b9-e49a-d544-8076-573fbeb50<br>
9f3]<br>
2008-10-27 23:02:59 [INFO] mod_dialplan_xml.c:228 dialplan_hunt() Processing FreeSwitch->8337 in context default<br>
2008-10-27 23:02:59 [NOTICE] mod_spidermonkey.c:2034 session_answer() Channel [sofia/internal/<a href="mailto:1000@10.0.0.2">1000@10.0.0.2</a>] has been answered<br>
2008-10-27 23:03:10 [NOTICE] switch_core_state_machine.c:157 switch_core_standard_on_execute() Hangup sofia/internal/<a href="mailto:1000@10.0.0.2">1000@10.0.0.2</a> [CS_EXECUTE] [NORMAL<br>
_CLEARING]<br>
2008-10-27 23:03:10 [NOTICE] switch_core_session.c:812 switch_core_session_thread() Session 9 (sofia/internal/<a href="mailto:1000@10.0.0.2">1000@10.0.0.2</a>) Ended<br>
2008-10-27 23:03:10 [NOTICE] switch_core_session.c:814 switch_core_session_thread() Close Channel sofia/internal/<a href="mailto:1000@10.0.0.2">1000@10.0.0.2</a> [CS_HANGUP]<br>
<br>
<br>
However, the sound has was quite static filled. <br>
What's the cause of all that static and how do I fix (remove) it?<br>
<br>
Thanks. Mark.</font>
<div id='MAILCIADA013-884e4906b802297' class='aol_ad_footer'><BR/><FONT style="color: black; font: normal 10pt ARIAL, SAN-SERIF;"><HR style="MARGIN-TOP: 10px"></HR>McCain or Obama? Stay updated on coverage of the Presidential race while you browse - <a href="http://pr.atwola.com/promoclk/100000075x1211139166x1200680084/aol?redir=http://toolbar.aol.com/elections/download.html?ncid=emlweusdown00000002">Download Now!</a></FONT> </div>