E911 Notification - Dashboard widget / Email / SMS text / Paging

This is will not work. It’s a POTS/PRI CallerID setting. It’s not used in SIP.

If this is a SIP phone sending the call to Asterisk then the dialed digits are 811 (in this case) when it hits the dialplan it will be the ${EXTEN} variable and when you send it to the Macro() you need to send ${EXTEN} as the argument in the Macro call. So it would be more like

exten => 811,1,Macro(dialout-trunk-predial-hook,${EXTEN})

[macro-dialout-trunk-predial-hook] 
exten => s,1,ExecIf($["${ARG1}"="811"]?System(echo "Ext ${AMPUSER} - ${AMPUSERCIDNAME} just placed a ${ARG1} emergency call on $TRFTIME(%C%m%d%y%H%M)}" | mailx -r "[email protected]" -s "${ARG1} Alert from ext ${AMPUSER} - ${AMPUSERCIDNAME}" [email protected])) 
exten => s,n,MacroExit()

Well, it does work, at least with Asterisk 13. I’ve cleaned it up a bit so that the email has carriage returns and multiple lines:

[macro-dialout-trunk-predial-hook]
exten => s,1,ExecIf($["${CALLERID(dnid)}"="911"]?System(echo "Emergency Call Notification!\n\nCalled Number: ${CALLERID(dnid)}\nCalling Extension:  x. ${AMPUSER} - ${AMPUSERCIDNAME}\nDate/Time: ${STRFTIME(%C%m%d%y%H%M)}" | mailx -r "[email protected]" -s "${CALLERID(dnid)} Alert from x. ${AMPUSER} - ${AMPUSERCIDNAME}" [email protected]))
exten => s,n,MacroExit()

What I’d like to do is change it so that the entire code goes into from-internal-custom, but the FreePBX variable aren’t defined at that stage, so I’d have to use the Asterisk variables for everyone. I’m going to experiment with ${CALLERID(name)} and ${CALLERID(num)} to see if I can get the entire thing working there.

Where would the additional “exten => 811,1…” line that you’ve proposed go?

If you want to trigger the notification on 811 or the ten digit number of your PSAP, you could just use an OR operator in your ExecIf expression.

[macro-dialout-trunk-predial-hook]
exten => s,1,ExecIf($[$["${OUTNUM}"="811"] | $["${OUTNUM}"="your_psap_number"]]?System(whatever command you want to execute))

I do the occasional consult on emergency dialing. This is the framework I start with. It does not require that you anticipate dialed digits it only requires that the outbound call use a route that is marked as an emergency route:

[macro-dialout-trunk-predial-hook]
exten => s,1,Noop(Entering user defined context macro-dialout-trunk-predial-hook in extensions_custom.conf)
exten => s,n,GoSubIf($["${EMERGENCYROUTE}"="YES"]?to-emerg-custom,s,1)
exten => s,n,MacroExit
 
[to-emerg-custom]
exten => s,1,Noop(Entering user defined context to-emerg-custom in extensions_custom.conf)
; exten => s,n,dumpchan ; uncomment for debug
; additional dialplan lines as req'd
exten => s,n,Return
3 Likes

Adding a DumpChan() to a dialplan has often saved me hours.

3 Likes

Per OP subject line, the Already Be Conferencing solution I assembled currently supports Email, SMS Text, Voicemail and Conference Call notifications (but not dashboard widget or - yet - paging, great idea!) More information in this other post. Latest version is from today v16f.