[Freeswitch-users] warn and hangup after xx seconds
Francesco Facco de Lagarda
francesco at delagarda.com
Thu Jun 7 16:52:51 UTC 2018
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 :
* Broadcast a soundfile saying 30 seconds left
to both parties
* Terminating a call
After having calculated the max time allowed for a call
In both cases of:
* Digital lines (that have the on answer event)
* Analogue lines (that DONT; therefore I use a grace period from
when dialing ends
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 at lists.freeswitch.org> On
Behalf Of Francesco Facco de Lagarda
Sent: mercoledì 6 giugno 2018 20:06
To: 'FreeSWITCH Users Help' <freeswitch-users at 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 dont 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
dont have on_answer)
Thanks all
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20180607/aebc05fd/attachment.html>
More information about the FreeSWITCH-users
mailing list