Dial Plan problem

I am struggling a little bit with a dial plan issue.

I want to call a shell script as soon as a call comes in to send an e-mail.

Most parts do work, I am only fighting where to place it in the dialplan. I did try to add the code to the “ext-did-0002-custom” - however all calls seem to jump over the “include => ext-did-0002-custom” line.

exten => s,n,System(${ASTVARLIBDIR}/bin/sendmail.sh [email protected] “${STRFTIME(,%c)}” “${CALLERID(name)} ${CALLERID(num)}” “${EXTEN}” “${EPOCH}”)

Is this expected?

I have tried several variations of the above mentioned code (replace s with an actual DID) and did not get asterisk to call the ext-did-0002-custom.

I ended up using the “override” and added a second section for [ext-did-0002] however that will break any kind of trunk configuration from the web UI.

Thanks for your help!


Add the following to the extensions_custom.conf

exten => s,1,System(${ASTVARLIBDIR}/bin/sendmail.sh [email protected] "${STRFTIME(,,%c)}" "${CALLERID(name)} ${CALLERID(num)}" "${EXTEN}" "${EPOCH}")

Than in the GUI goto Tools -> Custom Destinations - Add
Enter the following

Custom Destination : custom-did-email,s,1
Description : Send DID to mail address
Note : Set this incoming DID to send an email Message

Than use this Custom Destination as the destination of you Incoming Route.

One last note, the @ symbol might give some troubles in some shells, maby you should escape is with a \


exten => s,n…

The “n” needs to be a “1” to become a recognizable first step. n will get jumped.