javascript scheduling multiple events excecute_on_answer
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(); }
try execute_on_answer_1 execute_on_answer_2 or set leg_timeout=120 and remove first execute_on_answer 2018-02-28 10:42 GMT+02:00 Francesco Facco de Lagarda < francesco@delagarda.com>:
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();
}
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
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
Alexandr sounds interesting but I’m very new to this! Can you please be more explicit? Do you mean:
sessOut.execute("set", "execute_on_answer_1=sched_hangup +120 alloted_timeout")
sessOut.execute("set", "execute_on_answer_2=sched_broadcast +60 playback::" + soundDir + "one_min_left.wav both");
Ie just adding _1 and _2 tor this two lines?
Francesco Facco de Lagarda
On 1 Mar 2018, at 10:21, Alexandr Popov <alexandr.popov@iqoption.com> wrote:
try execute_on_answer_1 execute_on_answer_2 or set leg_timeout=120 and remove first execute_on_answer
2018-02-28 10:42 GMT+02:00 Francesco Facco de Lagarda <francesco@delagarda.com>:
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 min before time ends, that plays a message “you have 1 minute left ..” 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;
if (sessOut.ready()) {
bridge(session, sessOut);
}
sessOut.hangup();
session.hangup();
}
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
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
participants (2)
-
Alexandr Popov
-
Francesco Facco de Lagarda