[Freeswitch-users] Unstable hangup hook in javascript
xuyan yang
xyangni at gmail.com
Fri Jul 23 11:27:15 PDT 2010
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 at gmail.com> wrote:
> It checks before and after blocking calls like that.
>
> On Jul 23, 2010 11:53 AM, "Dan" <freeswitch-users at 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 at gmail.com>
> *To: *"FreeSWITCH Users Help" <freeswitch-users at 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 at 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 at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100724/13c6d8b3/attachment.html
More information about the FreeSWITCH-users
mailing list