Security - Limit risk by calculating currently used connection time


Assuming your server got hacked, Hackers will try to call numbers, maybe somewhere in Africa to produce a high bill. To prevent or at least minimize the risk, maybe some math could be useful.
One could, based on some experience, lookup in the cdrs and calculate a daily average on how long outbound calls usually take place and add some buffer on that time.

The dialplan could start looking up this value from the database and deny new outbound calls when the individual calculated time is reached. To activate it again a special extension could be called (maybe with a pin) and give a number in same time units which will be subtracted for the rest of the day, stored in AstDB.
If the limit of time is not reached, new outbound calls will be set up with a maximum call duration of let’s say 60 minutes. When a call exceeds this time, we terminate all other active outbound calls/channels and force the users to redial to connect to their lost counterparts again. At this point one will hit the dialplan again at the very beginning where the GotoIf(), which checks for the “normal” summarized outbound time will do its job again and deny new outbound calls when condition is matched.

Is there a way to kill existing outbound calls/channels?

An even better way - if functionality supports this would be to ask for the elapsed time of all currently active outbound calls and do not terminate them as long as the limit of summed time is not reached and they did not reached the max call duration themselves. Is there a way to get the elapsed time of a outbound call?

What do you think?

channel request hangup command

also you can use AbsoluteTimeout() function to set a time to the call