Hey,
I’ve configured a custom extension that sends me an email if I’ve got a missed call. When the extension gets called, it sends an email to me and then hanging up using this script:
[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()
The dial field of the custom extension is set to local/s@send-email
I’ve got this from lgaetz.
I’d like to know how I can accomplish this for a second extension, I don’t really know how this stuff works, but I’m willing to learn.
If configuring the same thing and changing the “s” to “t” so the two codes can be differentiated, but then it doesn’t send anything at all.
Help?
[send-email]
exten => _.,1,NoOp(Entering user defined context [send-email] in extensions_custom.conf)
exten => _.,n,set(emailaddresss=${STRREPLACE(EXTEN,:,@)})
exten => _.,n,System(echo 'Call from ${CALLERID(name)} at ${CALLERID(number)}' | mail -s 'SUBJECT' '${emailaddresss}')
exten => _.,n,hangup()
Then the custom dial string becomes:
local/email:domain.com@send-email
you replace the @ symbol in the email address with a :
I was actually working recently on a similar project. Is there a possibility to pull the email address set in the Voicemail tab or in user management and set as a variable?
You could certainly do it with a custom bit of SQL. I have no idea if those values are exposed any other way, but I doubt it.
I have a custom MySQL database at one site with a lot of data in it that is pulled in for outbound call checks. So for something like this, you should just need to add a call to the asterisk database to pull the info.
[send-email-privat]
exten => _.,1,NoOp(Entering user defined context [send-email-privat] in extensions_custom.conf)
exten => _.,n,System(echo ‘Anrufer “${CALLERID(name)}” mit der Telefonnummer “${CALLERID(number)}” bittet um Rückruf. (Anschluss 12345)’ | mail -s ‘Ein Rückruf wurde angefordert’ ‘[email protected]’)
exten => _.,n,hangup()
Dialpattern is
local/xy@send-email-privat
But now it always send the same email twice. Any idea why?