Need to dial an extension when losing network connection to the ISP

Does anyone know of a way to dial an extension to a phone when the network goes out?

I understand I will have to program to event to monitor the network it’s communicating with FreePBX I am unsure of.

One way is to use a call.file, Make a file something like

Channel: Local/18005551212@outbound-allroutes
MaxRetries: 3
RetryTime: 10
WaitTime:15
Application: PlayBack
Data: silence/4&weasels-eaten-phonesys

if it readable by the asterisk user, when you mv it to /var/spool/asterisk/outbound it will do what I think you are asking. (Of course outbound-allroutes would need at least one route that doesn’t use the network that’s not there.)