Asterisk Variables (notification when call comes in via email)

I’m using this post to get notification when a caller calls in, but I want to add the phone number that they dialed (becuase I have 10 DIDs pointing to it).

I see on voip-info https://www.voip-info.org/wiki/view/Asterisk+variables they point out that I should be able to use ${DNID}: Dialed Number Identifier.
I’ve also tried ${CALLERID(dnid)} (below) and the email never gives me anything for that varriable.

Here is my entry into extensions_custom.conf

[send-email]
exten => s,1,NoOp(Entering user defined context [send-email] in extensions_custom.conf)
exten => s,n,System(echo ‘${CALLERID(number)} called telephone number ${CALLERID(dnid)}’ | mail -s ‘New call to ${CALLERID(dnid)}’ ‘[email protected]’)
exten => s,n,hangup()

Can someone point me in the right direction?

Hi!

If you want to receive an email each time a DID is called (which is not exactly what @lgaetz solution was meant to do), a better solution would be to use the Send to email module of CID Superfecta

I am not a 100% sure it provides the DID number that was called, you would have to check…

(I just remembered that I had this problem with another CID Superfecta module, I will have to take a look at this again…)

Have a nice day!

Nick

Bad news…

Unless it has changed since

it won’t work…

I did not remember that I had tried to have it working with Send to email too…

For some reason when I tried to have the “getter” return DID it didn’t work, it only worked if I hardcoded what the “getter” returned (which is of course useless…).

I will try to have a look at it in the coming days…

Have a nice day!

Nick

You want ${FROM_DID} but you can easily find what you want yourself by putting a DumpChan in your dialplan and watching the console for the output:

exten => s,n,DumpChan
2 Likes

Thank you Igaetz ${FROM_DID} did the trick!

1 Like