Skip to main content

How to prevent infinite loop?

Posted by antme on Tue, 07/18/2017

In the user portal if one extension forwards calls to another extension. And that other extension forwards calls back to the original extension. This causes an infinite loop with eventually causes the whole asterisk system to crash and drop calls. Is there any way in preventing this?

This also happens if the users dial *72.

I have set limitations on # of Outbound Calls and also Call Limits per extension but this doesn't seem to help as the loop in "server sided."

Please is there any way we can prevent this, I can't have one customer crash the whole system for every customer.


Submitted by mattdarnell on Wed, 07/26/2017 Permalink

Did you have a call limit per extension set? I would think that every forwarded call is a new call to Asterisk.

Submitted by eeman on Wed, 08/16/2017 Permalink

correct, if you use dialplan to forward a call you are using a different channel driver (chan_local) which is unaware of this condition. If the phone was sending a forward via temporarily moved to another device that pointed back to this one, it would detect a loop. There is no way to code around this because no matter how hard we try to look for it, someone always manages to screw it up by adding another layer. Instead of 2 devices forwarding to each other they instead make it a round robin of 3, then 4, etc. Its like they do this on purpose. I told one customer if it continued they would be forced to purchase single tenant so they're only screwing their own system up, and would get charged a bill to correct.