[Freeswitch-users] javascript scheduling multiple events excecute_on_answer

Francesco Facco de Lagarda francesco at delagarda.com
Wed Feb 28 08:42:22 UTC 2018


I am developing a calling platform using javascript.

 

I have code that calculates how long THAT user is allowed to call THAT
number for.

 

I am trying to schedule 2 events,

1.	1 min before time ends, that plays a message "you have 1 minute left
.."
2.	The actual hangup when the time expires..

 

Despite a zillion tests I have been unable to schedule BOTH events.. 

 

This is my code: for simplicity's sake I have set call time to 120 secs,
with warning at 60:

 

if (session.ready()) {

 

/***

Get user, number, etc.  code omitted for simplicity

**/

 

     var sessOut = new Session("sofia/gateway/ht503/" +  dialedNum +
"@192.168.0.201:5062");

     var totTime = 60;

     sessOut.execute("set", "execute_on_answer=sched_hangup +120
alloted_timeout")

     sessOut.execute("set", "execute_on_answer=sched_broadcast +60
playback::" + soundDir + "one_min_left.wav both");

 

     if (sessOut.ready()) {

          bridge(session, sessOut);

     }

     sessOut.hangup();

     session.hangup();

}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20180228/7d0444b2/attachment.html>


More information about the FreeSWITCH-users mailing list