<tt><font size=2>asterisk-users-bounces@lists.digium.com wrote on 08/13/2014
08:31:01 AM:<br>
<br>
> From: "Nick Olsen" <nick@flhsi.com></font></tt>
<br><tt><font size=2>> To: <asterisk-users@lists.digium.com>,
</font></tt>
<br><tt><font size=2>> Date: 08/13/2014 08:31 AM</font></tt>
<br><tt><font size=2>> Subject: [asterisk-users] Better info on call
failure</font></tt>
<br><tt><font size=2>> Sent by: asterisk-users-bounces@lists.digium.com</font></tt>
<br><tt><font size=2>> <br>
> Hey everyone,</font></tt>
<br><tt><font size=2>>  </font></tt>
<br><tt><font size=2>> Currently, I've got a PBX that is emailing me
on call failures to an<br>
> international SIP provider of ours.</font></tt>
<br><tt><font size=2>>  </font></tt>
<br><tt><font size=2>> I'm doing this with exten => 1,1,System(mail
-s "Call from $<br>
> {CALLERID(num)} to ${DNID} Failed with DialStatus ${DIALSTATUS}"
<br>
> nick@flhsi.com < /dev/null)</font></tt>
<br><tt><font size=2>>  </font></tt>
<br><tt><font size=2>> This works fine, However it's a little lacking.
For Instance,</font></tt>
<br><tt><font size=2>>  </font></tt>
<br><tt><font size=2>> Our INTL SIP provider will bounce back SIP status
messages if the <br>
> call is rejected. 503 Service unavailable. 6XX over rate limit. 6XX
<br>
> blocked destination..etc. Anyone have any ideas about how I might
<br>
> capture that and include it in my email. Right now they just all <br>
> bounce CHANUNAVAIL which is expected.</font></tt>
<br><tt><font size=2>>  </font></tt>
<br><tt><font size=2>> Thanks!</font></tt>
<br>
<br><tt><font size=2>You could write a shell script that handles the actual
mailing and pass in the information as arguments when calling the shell
script.</font></tt>
<br>
<br><tt><font size=2>exten => 1,1,System(/opt/scripts/asterisk/send-error-email.sh
${CALLERID(num)} ${DNID} ${DIALSTATUS} ${HANGUPCAUSE})</font></tt>
<br>
<br><tt><font size=2>In this fashion you could also have a body in your
message that contains all the extra information. This would work for basically
any variable you wanted to pull in from Asterisk.</font></tt>