Hello,<br><br>I have a very strange problem using mod_spidermonkey_curl in CentOS 5.5 x86_64 bit. Same setup i am using in other machine in Fedora 12, it works, is there any bugs????????? I receive OK, but when i use to compare it fails in logical statement.<br>
<br><br>FreeSWITCH Version 1.0.head (git-25ddef5 2010-09-24 01-55-54 +0200) Started.<br><br>Installation curl as:<br>==============<br>[root@a autoload_configs]# cat spidermonkey.conf.xml <br><configuration name="spidermonkey.conf" description="Spider Monkey JavaScript Plug-Ins"><br>
<modules><br> <load module="mod_spidermonkey_teletone"/><br> <load module="mod_spidermonkey_core_db"/><br> <load module="mod_spidermonkey_socket"/><br> <!--<load module="mod_spidermonkey_odbc"/>--><br>
<b> <load module="mod_spidermonkey_curl" /></b><br><br> </modules><br></configuration><br><br><br><br>.../scripts/helloworld.js:<br>============<br><br>use("CURL");<br>var menuselection = "";<br>
var promptfordigits_dtmf_digits = "";<br>var invalidRetry = 0;<br><br>/* This is getting failed, in Centos, but in other machine it works */<br>function my_callback(string, arg)<br>{<br> console_log("info", string);<br>
<br> //string = 'OK'; // then it works!!<br> //2010-10-08 18:40:53.585676 [INFO] mod_dialplan_xml.c:331 Processing 1002 <1002>->1200 in context default<br> <b> //2010-10-08 18:41:23.842965 [INFO] helloworld.js:42 OK</b><br>
//2010-10-08 18:41:35.962099 [NOTICE] switch_ivr.c:1480 Transfer sofia/internal/<a href="mailto:1002@z.com">1002@z.com</a> to XML[3000@default]<br> //2010-10-08 18:41:35.962099 [INFO] mod_dialplan_xml.c:331 Processing 1002 <1002>->3000 in context default<br>
//2010-10-08 18:41:43.134207 [NOTICE] sofia.c:528 Hangup sofia/internal/<a href="http://z.com">z.com</a> [CS_EXECUTE] [NORMAL_CLEARING]<br><br> <br> if (string=='OK') { <br> <br> //<br> //<br> // <<<<<<<<<<<<<<<<<<------------------ It receive OK but it never execute this two, and but it execute invalid macro<br>
//<br> //<br> //<br> session.sayPhrase("valid", menuselection, "en");<br> session.execute("transfer", '3000');<br> } else {<br> session.sayPhrase("invalid", menuselection, "en");<br>
return true;<br>}<br><br><br>/* FS wiki - example */<br>function promptfordigits_dtmf_callback(session, type, digits, arg)<br>{<br> console_log("digit: " + digits.digit + "\n");<br> promptfordigits_dtmf_digits += digits.digit;<br>
/* returning true does not interrupt the digit collection*/<br> return(true);<br>}<br><br>/* FS wiki - example */<br>function promptfordigits(ivrsession, promptname, numdigits, timeout)<br>{<br> var repeat = 0;<br>
<br> console_log("saymenu: menu=[" + promptname + "] numdigits=[" + numdigits + "]\n");<br><br> session.flushDigits();<br> promptfordigits_dtmf_digits = "";<br><br> while (ivrsession.ready() && promptfordigits_dtmf_digits.length < numdigits && repeat < 3) {<br>
/* play phrase - if digit keyed while playing callback will catch them.<br> If less than numdigits collected we get the rest after the prompt.*/<br> ivrsession.sayPhrase(promptname, numdigits, "en", promptfordigits_dtmf_callback, "");<br>
<br> console_log("Prompt done=[" + promptname + "] Collected " + promptfordigits_dtmf_digits.length + " digits [" + promptfordigits_dtmf_digits + "]\n");<br><br> /* if caller still here and has not entered any selection yet (or less than numdigits entered) - wait for the rest of the digits*/<br>
if (ivrsession.ready() && promptfordigits_dtmf_digits.length < numdigits ) {<br> promptfordigits_dtmf_digits += ivrsession.getDigits(numdigits - promptfordigits_dtmf_digits.length, "", timeout);<br>
/* if still no selection or insufficient digits repeat menu */<br> if (promptfordigits_dtmf_digits.length < numdigits) {<br> promptfordigits_dtmf_digits = "";<br> repeat++;<br>
}<br> }<br> }<br> return(promptfordigits_dtmf_digits);<br>}<br><br><br><br>function retry()<br>{<br> /* FS wiki - example */<br> menuselection = promptfordigits(session, "DialByNumberMenu", 8, 6000);<br>
<br> if ( session.ready() ) {<br><br> var curl = new CURL();<br>
curl.run( "POST",<br>
"<a href="http://portal/conference/query">http://portal/conference/query</a>",<br>
"om=" + menuselection + "&ty=__",<br>
my_callback,<br>
"my arg\n",<br>
"p:ier");<br><br> }<br><br>}<br><br><br>/**<br> * Let's answer our call<br> */<br>session.answer();<br>retry();<br><br><br><br><br>Thanks & Regards<br><br><br>