I added many <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">session.ready() as below and re-do the test again.</span><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">the steps are:</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">1. type jsrun test.js in fs_cli</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">2. answer the call in x-lite.</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">3. when I hear the speech, hangup the call in about 1 second.</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">4 check the log to find "</span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">hangup!!!!!!!!!!!!!"</span></div>
<div><br><div>the result is that</div><div> about half of the test failed to call hangup hook.</div><div>in all tests the script end up with [ERR] inline:1 Session is not active! then the script stopped and session.ready() near the end can not get the chance to run.</div>
<div><br></div><div><br></div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div>////test.js</div><div>function on_hangup(session, how){</div>
<div><span style="white-space: pre-wrap; ">        </span>console_log("notice","hangup!!!!!!!!!!!!!\n");</div><div>}</div><div><br></div><div>session = new Session("sofia/gateway/12voip-out/*********");</div>
<div>session.waitForAnswer();</div><div>session.ready();</div><div>session.execute("set","continue_on_fail=true");</div><div>var res=session.setHangupHook(on_hangup);</div><div>console_log("notice","res:"+res+"\n");</div>
<div>if(session.ready())session.execute("speak", "This is an example of flite text to speech engine. We can test the work of hanguphook.");</div><div>if(session.ready())session.execute("speak","you are calling from " + session.caller_id_num + " You are calling " + session.destination );</div>
<div>session.ready();</div><div>session.hangup();</div></span></div><div><br><div class="gmail_quote">On Sat, Jul 24, 2010 at 1:08 AM, Anthony Minessale <span dir="ltr"><<a href="mailto:anthony.minessale@gmail.com">anthony.minessale@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><p>It checks before and after blocking calls like that.<br>
</p>
<p></p><blockquote type="cite"><div class="im">On Jul 23, 2010 11:53 AM, "Dan" <<a href="mailto:freeswitch-users@digitaldan.com" target="_blank">freeswitch-users@digitaldan.com</a>> wrote:<br><br></div><div>
<div style="font-family:Times New Roman;font-size:12pt;color:#000000"><div class="im">
So If I call session.recordFile which blocks in code until the user hangs up, and can't make periodic calls to session.ready, is the hangup hook not realiable in this scenario? <br><br><hr><b>From: </b>"Anthony Minessale" <<a href="mailto:anthony.minessale@gmail.com" target="_blank">anthony.minessale@gmail.com</a>><br>
<b>To: </b>"FreeSWITCH Users Help" <<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>><br><b>Sent: </b>Thursday, July 22, 2010 10:30:48 AM<br>
<b>Subject: </b>Re: [Freeswitch-users] Unstable hangup hook in javascript</div><p><font color="#500050"><br><br>You must make periodic calls to session.ready() or some other freeswitch api functions to trigger ...</font></p>
</div>
</div><div class="im"><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></div></blockquote><p></p>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div></div>