Sometimes I have the IMMESURABLE pleasure of posting and sharing the solution of a problem I had…
The problem:
I wanted to be able to :
After having calculated the max time allowed for a call
In both cases of:
All this in javascript..
So I did:
var endSecs = secsMax + secsGrace;
var warnSecs = secsMax +secsGrace - 30;
where secsGrace is ZERO for digital lines …
then, for digital I use after the session out ready, so :
if (sessOut.ready()) {
sessOut.execute("set", "execute_on_answer_1=sched_broadcast +" + warnSecs + " playback::" + soundDir + "time_off.wav both");
sessOut.execute("set", "execute_on_answer_2=sched_hangup +" + endSecs);
}
And for analogue, BEFORE thesessout ready
sessOut.execute("sched_hangup", "+" + endSecs + " alloted_timeout");
sessOut.execute("sched_broadcast", "+" + warnSecs + " " + soundDir + "time_off.wav both");
Tried and tested..
I HOPE it helps someone
From: FreeSWITCH-users <freeswitch-users-bounces@lists.freeswitch.org> On Behalf Of Francesco Facco de Lagarda
Sent: mercoledė 6 giugno 2018 20:06
To: 'FreeSWITCH Users Help' <freeswitch-users@lists.freeswitch.org>
Subject: [Freeswitch-users] warn and hangup after xx seconds
I am scripting in js
I have both analogue and digital trunks out (analogue trunks out don’t give me the “answer” event)
Lets say we have a “totTime” variable for max length of call
I need to play a warning at totTime – 30
And hangup at totTime..
I have tried using:
sessOut.execute("set", "execute_on_answer_1=sched_hangup +” + totTime + “ alloted_timeout");
sessOut.execute("set", "execute_on_answer_2=sched_broadcast +” + (totTime – 30) + “layback::" + soundDir + "time_off.wav both");
But I can only get one or the other to work.. never both!
Also, how would I schedule there two events for analogue lines (where I don’t have “on_answer”)
Thanks all