OutboundRoute Mail Event - WORKING


Trying desperately to get 911 alerts working and coming up short.
it seems like it should be fairly simple but it never triggers.

I have my outbound route defined (EMERGENCY) - and it is working correctly
then in extensions_custom.conf I’ve added the custom code I want to run when that route is utilized
so I have:

exten => 911,1,System(echo ‘${DATETIME} - ${CALLERID} - ${CHANNEL}’ >> /var/log/asterisk/911alerts)
exten => 911,n(911alert),NoOp()
exten => 911,n,System(/bin/mail -s “User ${CALLERID(NUM)} has made an 911 call. ${EXTEN} on ${STRFTIME(%C%m%d%y%H%M)}” [email protected] < /tmp/footer)
exten => 911,n(911alert),NoOp()

; end of [outrt-002-EMERGENCY-custom]

So I’ve saved that - ran reload in asterisk CLI

I can “show dialplan” and see that it has loaded but I get neither an emailed event nor an entry in the log via the echo command.
what am I missing?

Thanks so much! and thank you for these wonderful forums.

Turns out it has to be put in the context of the originating phone.
(at least for the way I want it)
I wanted an alert when any one called 911, or 9911

So in extensions_custom.conf, for each ORIGINATING context that I have I added a _CUSTOM context to extensions_custom.conf

For example, the default context looks like this:


exten => 911,1,System(echo “911 call from ${CALLERID(NUM)} - ${CALLERID(NAME)} at ${STRFTIME(%C%m%d%y%H%M)}” | mail -s “911 Alert at ${CALLERID(NUM)}” [email protected])
exten => 9911,1,System(echo “911 call from ${CALLERID(NUM)} - ${CALLERID(NAME)} at ${STRFTIME(%C%m%d%y%H%M)}” | mail -s “911 Alert at ${CALLERID(NUM)}” [email protected])

And then you’ll need to add it again for any other custom context you have added and set.