give lastest HEAD a try, I pushed in some more checks and made calling session.hangup() nonfatal when it's already hungup.


On Fri, Jul 23, 2010 at 1:27 PM, xuyan yang <xyangni@gmail.com> wrote:
I added many session.ready() as below and re-do the test again.
the steps are:
1. type jsrun test.js   in fs_cli
2. answer the call in x-lite.
3. when I hear the speech, hangup the call in about 1 second.
4 check the log to find  "hangup!!!!!!!!!!!!!"

the result is that
 about half of the test failed to call hangup hook.
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.



////test.js
function on_hangup(session, how){
console_log("notice","hangup!!!!!!!!!!!!!\n");
}

session = new Session("sofia/gateway/12voip-out/*********");
session.waitForAnswer();
session.ready();
session.execute("set","continue_on_fail=true");
var res=session.setHangupHook(on_hangup);
console_log("notice","res:"+res+"\n");
if(session.ready())session.execute("speak", "This is an example of flite text to speech engine. We can test the work of hanguphook.");
if(session.ready())session.execute("speak","you are calling from " + session.caller_id_num + " You are calling " + session.destination );
session.ready();
session.hangup();

On Sat, Jul 24, 2010 at 1:08 AM, Anthony Minessale <anthony.minessale@gmail.com> wrote:

It checks before and after blocking calls like that.

On Jul 23, 2010 11:53 AM, "Dan" <freeswitch-users@digitaldan.com> wrote:

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? 


From: "Anthony Minessale" <anthony.minessale@gmail.com>
To: "FreeSWITCH Users Help" <freeswitch-users@lists.freeswitch.org>
Sent: Thursday, July 22, 2010 10:30:48 AM
Subject: Re: [Freeswitch-users] Unstable hangup hook in javascript



You must make periodic calls to session.ready() or some other freeswitch api functions to trigger ...


_______________________________________________
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



_______________________________________________
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




--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
googletalk:conf+888@conference.freeswitch.org
pstn:+19193869900