give lastest HEAD a try, I pushed in some more checks and made calling session.hangup() nonfatal when it's already hungup.<div><br><div><br><div class="gmail_quote">On Fri, Jul 23, 2010 at 1:27 PM, xuyan yang <span dir="ltr"><<a href="mailto:xyangni@gmail.com">xyangni@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I added many <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 face="arial, sans-serif"><span style="border-collapse:collapse">the steps are:</span></font></div>
<div><font face="arial, sans-serif"><span style="border-collapse:collapse">1. type jsrun test.js in fs_cli</span></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse">2. answer the call in x-lite.</span></font></div>
<div><font face="arial, sans-serif"><span style="border-collapse:collapse">3. when I hear the speech, hangup the call in about 1 second.</span></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse">4 check the log to find "</span></font><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 style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><div class="im"><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><div>session.ready();</div><div class="im"><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><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><div></div><div class="h5"><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" target="_blank">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>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>
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><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" 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></blockquote></div><br></div></div></div></div>
<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><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:+19193869900<br>
</div></div>