Email or Text Message on Extension Unregister

I have an issue where extension will randomly unregister from my FreePBX box from a Sangoma Vega 5000. This happens at random and I can not reproduce it.

Is there anything that can be done that could kick off an email or text message when an extension unregistered? I am currently blind when this happens and am only made aware when the user reports the extension isn’t working. The last time this happened was with an extension used to kick off our emergency paging routine. Luckily this was only during a test, but had it been an actual emergency, it would have been an serious issue.

My FreePBX version is 5.211.65-21.

You can create a cronjob to monitor via AMI or via asterisk -rx the state of your peers. If one or more peers are unavailable send an email using mutt or mail shell command.

If you use Nagios to monitor your network, you could easily add check to see how many extensions are registered and send an e-mail or page when the number changes. Alternately, you could easily add a check (by querying AMI) to see each extension and make sure it’s connected.