Auto terminate call via script


We are running Elastix version 2.4 which I think runs freepbx in background, so since there is no option via web panel of Elastix version 2.4 to achieve what we need so I have to ask it here as someone told me it will be possible via freepbx script if I add it in crontab of Linux.

Issue we have is that agents make very long duration calls, so we need a script to terminate all calls(for every agent) after 20 minutes of duration, and for agents who comes in evening shift after 6:00 to terminate their calls after every 30 minutes(as they are good guys and hangs up call properly). Also, if possible in the same script can we except any particular agent from this so he/she should not have any limits?

Can someone please provide me kind of that script? and will it work on Elastix version 2.4 if I make it via crontab of Linux?

Thanks in advance.


For peer support for FreePBX use

I don’t think you will find that script on the Internet or on this forum. You will need to do it yourself. ExecIf or GotoIftime() and TIMEOUT(absolute) + Linux Cron can do the Job.


Can’t we do it like this

(Existing calls >= 20 minutes & time = 9 to 6) than hangup OR if (Existing calls >= 30 minutes & time = 6 to 9) than hangup

I hope there should be a way to script this so it can run behind Elastix version 2.4 which does not have this functionality anywhere…

Also, if possible can we have a script where I can define only following country codes can which can call beyond 30 minutes otherwise all are 20 minutes anytime a day/night.


It is easier if you set the time out before connect the call… You can use some kind of logic with GotoIftime() and GotoIf()

Hi, do you have any example in your mind which I can try of? … ECT-3.html