How can incoming SIP NOTIFY messages be handled?

I’m running into an interesting situation on our FreePBX box. We have a trunk from a commercial VoIP provider that normally provides a VoIP adapter to end users, but also allows BYOD and even provides settings for Asterisk users - still, you are considered an end user, not a “peer.” Everything works great except that if by some chance our server goes down, we lose Internet connectivity, etc. then the provider’s voicemail will catch any incoming calls. So far, so good, except that we get no notification that there are voicemail messages waiting. Actually, that’s not quite correct - we DO get SIP NOTIFY messages from the provider, that I assume would turn on the MWI in a VoIP adapter, the same as Asterisk sends to your phone or device if you have a voicemail message waiting.

The problem is that although Asterisk seems perfectly capable of sending these notify messages to endpoints, I can’t figure out how to make it respond to incoming notification messages from an upstream provider. You can’t even see these messages unless you turn full SIP debugging on (which causes your log files to be HUGE, and makes the CLI virtually unreadable in real time). What I’d like to know is, is there any way to make Asterisk actually DO something when one of these “102 NOTIFY” messages is received from an upstream provider? Even if it could just write the details to some kind of temporary file, I could then figure out some way to act upon it. Does Asterisk have any way at all of handing an INCOMING message waiting (or other) notification, that anyone knows of?

Just to note, I am aware that most upstream providers will let you turn off voicemail. But if the Internet goes down - and ours does just a little too often - it’s nice to have the backup voicemail at the provider’s server. And if I don’t realize that there’s been an outage, then I might not think to check for voicemails.

No simple way to do this. I would just have the providers VM email you.

You could hack up a script on OpenSER to do this.