We have a number of Asterisk servers; occasionally, human error means someone messes up the dialplan and incoming calls are rejected:
NOTICE[27927][C-00000188]: chan_sip.c:26826 handle_request_invite: Call from 'upstream-peer' (192.168.1.1:5060) to extension '44123123123' rejected because extension not found in context 'ourcontext'.
I'd like to implement a small piece of code that will raise some kind of alert when this happens, so we can fix it quickly.
I can (and do) use AMI to get all sorts of events out of the server - when channels are created, when calls end etc - but I can't seem to find any event or command that will raise an AMI event when a call is rejected. Does anyone know if such a thing exists?
Thanks to @arheops for the inspiration: I'd added this to the bottom of the context dialplan:
_X.will catch any number; as the dialplan is parsed in order, then only (presumably invalid) numbers that have reached the bottom of the plan will be caught by this wildcard match.Then, in my monitoring application I handle the
UserEventsevent:with something simple like:
Not as "clean" as I've have liked it, but it appears to work.