Sending Email On 911 Abandonment

I’m trying to figure out the best way to approach this.

In our current Alcatel system, it is configured so that the caller cannot disconnect a 911 call, only the PSAP can do it. This helps sometimes if there’s an accidental 911 call. I did learn in a thread I posted last year that it’s difficult to achieve that same functionality with FreePBX, so I’m thinking of trying something else at least that, while it wouldn’t prevent someone from hanging up in panic when they hear “911, where’s your emergency?”

My thought is to have the length of the call monitored. Once the PSAP picks up the call, it looks at the timer from there. If the call length is less than let’s say, 5 seconds, there’s a high chance that the caller hung up on 911 before saying it was an accident. Then if it detects that short call length, have the system send an email to the relevant staff in the school building from which the 911 call was placed so those staff members can go make sure the person is okay, but also so they can call emergency services back.

I know this wouldn’t be necessary in a normal scenario when buildings are full during the school year (as the paging group would alert the staff of a 911 call). But during the summer when there is not much staff around, it would be good to have an email alert like that. Even with the buildings being mostly empty, there are a few people (myself included) that get alerted to 911 calls regardless of where they were made from, so one of us could reach out to the PSAP in a situation like this.

Let me know if I rambled too much. I guess I could make one of those tl;dr

tl;dr: monitor length of 911 call; if length is below a threshold, it’s probably a hang up, so email relevant staff that there was a 911 hang up in their building

If this is possible it would require some custom programming and maybe somebody else here could provide you with specifics for that.

However there is a built in way to email when an Outbound Route was dialed out from which would email people when any 911 call is made.

We have this enabled on pretty much all of our deployments as it seems helpful to know that a 911 call was made regardless if that call was hung up on or not.

On top of the email we also record all such calls so that they can be reviewed later on.

1 Like

Ah that is true. I do have emails set up (well, trying to with custom dialplan plus a script that choose which email list to email depending on what school, so I don’t have 30+ outbound routes, one for each school building). Unless there’s an easier way to do that too!

I might still try to do some custom programming for hang up calls, as someone who gets the email might assume it’s just a regular call and not realize it was a hang up. I know people don’t like get inundated with emails, but I might have something for specifically hang ups.

I will say that if you are getting inundated with emails about 911 calls then I don’t envy you or your environment.

Fair enough. I think I used “inundated” too lightly. If I have more than four browser tabs open, I start looking at what I can close. I’m a little anxious right now with the seven I currently have open, so it might be “inundated” to me! Though yesterday I made a test call from one of our school that we just ported numbers from one carrier to another, and the Alcatel system sent me seven emails for the same call at the same time.

It’s going to be difficult for analogue, but SIP can’t do this, at all, on any system.

Ah okay, yeah. Of course a lot of this can be taken care of by instructing users with what I believe should be common sense - if you accidentally call 911, do not hang up, let them know it was an accident (happens a lot since you need to dial 9 for an external call, then 1 for long distance, a lot of people autocomplete and do 911).

Can you run a script that queries the CDR on 911 dials and looks for the specifics?

Maybe tie the script to a special (emergency) route you send all 911 calls though. If call meets these criteria, do X, otherwise do nothing?

I thought about something like that. Can you query the CDR on a live call though, or does it just show call information after the fact? I can test this afternoon and see if I can grab the call length to know if it updates live in the middle of a call if I just re-run the query.

CDR / CEL tables are populated when the call ends.

I guess though that makes sense to still utilize the CDR. I didn’t think clearly before, but yeah the email needs to come through when the call ends, so that’s the right time to look at it.

I don’t think you can run it while the call is ongoing. But still not an issue, as the script you create can just have a wait command for X seconds before querying the CDR. If it was 5 seconds for example, wait 10 seconds, then query. If the call is not there, it was longer than 10 seconds.

1 Like

Ignore my first reply. I see what you’re saying and it makes sense, since the email would need to be sent after the call ends. Just simple query on end and then email if it falls below the threshold.

Yep, that was my original thought.

You can use the OS to asynchronously ‘tail -F’ the full log for a call to 911 and send an email or anything else on such an event at the moment it happens and before the call ends.

We use this custom config to send emails as calls are placed incoming from the PSTN (e.g. at the start of the call), perhaps you could do adapt to something similar?

[from-pstn-custom]
include => custom-send-email-alert

[custom-send-email-alert]
exten => _33333333*333,1,System(${ASTVARLIBDIR}/bin/sendmail.sh email1@domain1,email2@domain2 '${STRFTIME(,,%c)}' '${CALLERID(name)}' '${CALLERID(num)}' '${FROM_DID}')

The script is fairly dumb:

#!/bin/bash
# Script to send alerts on incoming calls to certain destinations.
# $1 - email address to send to
# $2 - current time
# $3 - CallerID
# $4 - Called number

ARG1=${1:[email protected]}
ARG2=${2:-`date`}
ARG3=${3:-NO_CALLERID_SUPPLIED}
ARG4=${4:-NO_CALLED_NUMBER_SUPPLIED}

# echo "\$ARG1 Email: ${ARG1}"
# echo "\$ARG2 Datestamp: ${ARG2}"
# echo "\$ARG3 CallerID: ${ARG3}"
# echo "\$ARG4 CalledNo: ${ARG4}"

TMPFILE=`mktemp -p /var/spool/asterisk/tmp/ tmp.XXXXX`

echo "FROM:[email protected]" >> $TMPFILE
echo "TO: "$ARG1 >> $TMPFILE
echo "Subject: New call for "$ARG3" recieved " >> $TMPFILE
echo ""
echo "Just wanted to let you know, you received a new call:" >> $TMPFILE
echo -e "Dialled number:\t\t"$ARG3 >> $TMPFILE
echo -e "From CallerID:\t\t"$ARG4 >> $TMPFILE
echo -e "Timestamp:\t\t"$ARG2 >> $TMPFILE
echo "" >> $TMPFILE
echo "." >> $TMPFILE

/usr/sbin/sendmail $ARG1 < $TMPFILE

rm $TMPFILE
1 Like

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