This is how I do it (in javascipt)…

 

 

if (session.ready()) {

 

    session.answer();

   

                endSecs                              = 600; // 10 minutes

               

                var sessOut = new Session(trunk + dialedNum);

                if (sessOut.ready()) {

                               sessOut.execute("set", "execute_on_answer_2=sched_hangup +" + endSecs);

                               bridge(session, sessOut);

                }

 

               

                sessOut.hangup();

                session.hangup();

}

 

 

From: FreeSWITCH-users <freeswitch-users-bounces@lists.freeswitch.org> On Behalf Of Rick Jarvis
Sent: martedì 3 luglio 2018 16:38
To: FreeSWITCH Help <freeswitch-users@lists.freeswitch.org>
Subject: [Freeswitch-users] Limiting call length

 

Hey all

 

Looking for a way to limit all calls to a maximum of 10 minutes, when originating a call using the event socket.

 

I’ve tried using sched_hangup like this:

 

originate {origination_caller_id_number=01234567890,execute_on_answer=sched_hangup +600 alloted_timeout}sofia/. . . . 

 

But no dice…

 

R