How to send email on every call received at a DID, even if it gets answers, leaves vm, hangs up, etc?

In short, I would like to receive an email for every phone call that gets made to a particular phone number (listed as an inbound route of course). In our PBX, this particular phone number’s route is an IVR. I would like to have FreePBX send the email when the call is first received, however, I don’t want the call to be delayed in the case that FreePBX experiences some issue sending the email.

Any advice? I’m using FreePBX 15.0.17.17

I saw this article, but I’m unsure how to apply it to my needs since I don’t want to send callers here, then hangup.

You might need to call a hooker.

4 Likes

Thanks. What I ended up doing was exactly as described here: Email notification of incoming/missed call.

With this solution, I created a dummy extension, and made that the first number dialed for the desired ring groups. Then, when configuring a CallerID Prefix in the ring group, the email received contains the name of the ring group. This allows me to know which function / options the user pressed when I receive my call notification email.

1 Like

Great, easy solution!

That works, but with the type of call flow you are using, it can be easier. Create a context like:

[send-email]
exten => s,1,NoOp(Entering user defined context  [send-email] in extensions_custom.conf)
exten => s,n,System(echo 'Call from ${CALLERID(name)} at  ${CALLERID(number)}' | mail -s 'SUBJECT' '[email protected]')
exten => s,n,Return()

The final line changes to a return. Then create a Custom Destination that references the above as

send-email,s,1

And be sure to enable the return option and choose the IVR as the destination. You then edit the inbound route to go to the Custom Destination.

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