Detecting If 911 Is Called From Any Phone

I’m not sure if this is the right place to ask, but I almost have a Python program in place to do a pop up on a user’s computer if 911 is called from one of the buildings.

The part I’m unsure of though: I’m using the AMI and using “Getvar” to get the CALLERID(dnid) to see if it’s 911 (or in my testing case, just my cell phone number). It works if I hard code in a Channel name to do. What I am trying to figure out, and I may be overlooking something or asking for the impossible, is for it to detect from any and all channels if one of them is connected with the PSAP. I don’t want to have to specify one channel, especially since the channel name changes (like right now it’s “PJSIP/3717-0000001d” but earlier it was “PJSIP/3717-00000009” for example).

Is there someone that can point me in the right direction, or has an example of what I’m trying to accomplish already in place? Looking at the Asterisk Wiki at the “Getvar” action if I don’t specify a channel, it would look globally at that variable. Wouldn’t that mean that without giving it the channel that it would be able to see the value of that variable is the emergency number?


There may well be a way to do this with AMI, but I think it would be easier to hook the dialplan and check for the channel variable EMERGENCYROUTE = YES then make the API call in dialplan.

1 Like

Thanks for the post! I’ve gone through the post and it’s helped me familiarize myself with some of the dialplan and hooking.

The Python script I have planned on residing on certain users’ computers, it doesn’t sit on the FreePBX box itself. Can I still utilize the Python program by calling it from the dialplan?

I did find these two threads in the Asterisk community forums. I’m a little unsure how the CURL works, even reading through the documentation for it. Can you point me in the right direction with that a little, or am I going down the wrong path with CURL?

Python API in Dialplan - Asterisk / Asterisk APIs - Asterisk Community

API call from asterisk server - Asterisk / Asterisk APIs - Asterisk Community

exten => s,1,Set(CURL(http://localhost:8088/static/astman.css)=/var/spool/asterisk/tmp/astman.css))

I’m curious how I can use that to make the pop up window appear on the user’s machine.


@lgaetz I think this would be a very good feature request to add to the normal outbound route notificaiton section as an option. This being a way to call a web url in addition to email and page.

Was this ever brought up when this function was added?

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.