I have a SIP doorbell connected to freepbx. I have set it to call a Ring group, which includes two internal extensions and one external number, which all ring simultaneously. I am wondering if there is anyway to receive an email notification of an incoming/missed call, so if I don’t happen to have access to my phone I can still receive notification via email that the doorbell has been pressed?
If anyone has any ideas about how I might do this I would be grateful I have configured email server settings in freepbx
If I was doing this, I would create a new context in /etc/asterisk/extensions_custom.conf with content similar to:
[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,hangup()
Then in FreePBX create an extension of type, other (custom) device, give it a name and number. In the dial field use:
local/s@send-email
Now you have a local dummy extension that will execute custom code whenever it is dialed. You can include it in ring groups, or queues, etc. It will never answer the call, but whenever it rings it will execute the custom code. You have the basis for adding your own code for whatever you can dream up once you learn a bit of Asterisk.
OK, that look great! Just wondering how I create a new context… can I do this in the admin control panel, or do I need to do it on the computer via linux?
That works too. In lieu of creating a custom extension, you could do the same thing with a Custom Destination to “send-email,s,1” and a Custom Application. Then use the feature code created by the CA in the ring group or follow me. With this method you have to remember to suffix the feature code with a # when using in a ring group.
When I execute this line into the CLI I receive the error:
No such command ‘nano /etc/asterisk/extensions_custom.conf’ (type ‘core show help nano /etc/asterisk/extensions_custom.conf’ for other possible commands)
Sorry I am a novice at this, but some more advice would be much appreciated :)))
you need to ssh root@your-pbx-address (if on windows,use putty) and give that command into the shell (you can also yum install mc, and then use mcedit /etc/asterisk/extensions_custom.conf instead - all that from under the ssh or telnet console NOT asterisk CLI)
If have added the new context, saved the file and made a new custom extension, with the advised dial field. When I dial the extension, it rings but I don’t receive an email. Email is setup, as I receive voicemail and system update notifications. Tell me what I have done wrong! This is a screenshot of my edited file, is there anything else I need to change? It says ‘modified’, as I typed something when I took the screenshot :.)
That script is wonderful, however, unfortunately, the caller ID number is appearing in the place where the caller id NAME should be. I’ve connected the OPEN 79XX telephone database to my asterisk/freepbx setup. it appears on my phones, however in a missed call email with the above script, instead of the number and name, I get two copies of the number. Is anyone able to help me?
I expect the phones are pulling the name independently from the database, so Asterisk is not aware of the CallerID name for the call. Use CallerID Superfecta to get the CNAM for the call from OPEN 79XX.
Lgaetz’s solution worked very well for me, but I’d like to be able to look up the correct e-mail address associated with the extension, instead of using a single hard-coded one for everyone. Is there a handy way to get that information already?
If not, every user has a default extension in the userman_users table of the Asterisk database, so something like:
select email from userman_users where default_extension = ${EXTTOCALL};
would retrieve the e-mail address that matches this extension. Setting up a MySQL/MariaDB connection just for one retrieval seems pretty heavy, though. Is there already an established MySQL connection I can use in extensions_custom.conf so I don’t have to run my own MySQL Connect each time?
If I have to set up the connection myself, I tried something like this:
but found that it did not pick up root’s .my.login credentials. Is there an option to avoid having to hard-code the MySQL login password in the Connect statement.
Thanks in advance for any help anyone can provide.
A feature request to add extention_email into the ASTDB would work.
The process would be something along the line of:
Create the User in UCP.
IF an email address exists and the default extension is set, add the email to the Asterisk database.
This would require a change to the way UCP works now, but is a reasonable change since most people have email associated with their UCP account, and not having to dredge through the MySQL tables would be a cool boon.
Note that you could also write an AMI/ARI script that will schlepp through the MySQL database and copy all of the extension+email combinations to the Asterisk database. Since ASTDB is persistent, you’d only have to run an update when you add a new user.
So this is working great for me but I was hoping to tweak it to use the Supefecta result instead of the CallerID lookup. We have the users in Connectwise and want to return the name if finds there rather than a generic caller id lookup.