When Internet down calls do not go out to pots line

Our outbound route uses voip [iax2] then pots.

When the internet goes down, we can not make outgoing calls.
Asterisk logs show that the iax2 line trying to be used.

If I then restart the phone computer calls will go out using the pots trunk.

My question is: do you know of a way to have voip trunks auto disable if the net goes down?


I know you can partially deal with it by having a caching name server but it would be nice to have them fail gracefully.

the big part fo this is if any configuration data for a trunk has a fully qualified domain name and needs DNS to resolve it, that process will hang if the server does not have a local DNS server to query but instead does the query externally. There are timeout values for each query and then it moves to the next defined dns server, on down the line unilt it has run out, it then repeats the process 3 times if memory serves me correctly. So by then the box seems hung as it’s waiting for a dns query to finish while another is going on, etc… you see how it get’s out of hand. Having a local as in either installed on the server it’s self or inside the same local network) will then always respond way within the first query time period returning a value (be it good or bad).

Next there is a way to monitor trunks for errors in 2.4 and newer (think it was introduced in late 2.3 versions) and call a custom AGI script (which you need to write). You need to implement this so that it knows to report when a error occurs and save that state. Then lastly create a context in the extensions_custom.conf file called [dialout-trunk-predial-hook] which then checks the results of that error and verifies that the internet is down via something like a simple ping to a known outside address and if it is down then return with the variable bypass set to 1, which will tell the trunk code to bypass attempting to use that trunk.

I think if you go searching the forums somebody already wrote the agi script and offered it up. So search for trunk failure monitoring.