Hi, I'm sure this topic has been discussed before but i'm having trouble finding a simple answer. Whats the easiest way of sending an email from Asterisk? I want to set up a warning so that after a Dial cmd, if the DIALSTATUS is CHANUNAVAIL, Asterisk sends an email to the admin to check the voip phone is connected properly. I've got the dial plan set up, I just dont know what command to use to send the email. Thanks Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20101020/dbf0e967/attachment.htm
On Wed, 20 Oct 2010, Dan Journo wrote:> I want to set up a warning so that after a Dial cmd, if the DIALSTATUS is CHANUNAVAIL, Asterisk sends an email to the > admin to check the voip phone is connected properly. > > I've got the dial plan set up, I just dont know what command to use to send the email.Off the top of my head... exten = *,n,system(echo Call to ${DNIS} failed | mail -s 'Call failed' root at localhost) -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000
thanks. Ill give that a go. Steve Edwards <asterisk.org at sedwards.com> wrote: On Wed, 20 Oct 2010, Dan Journo wrote:> I want to set up a warning so that after a Dial cmd, if the DIALSTATUS is CHANUNAVAIL, Asterisk sends an email to the > admin to check the voip phone is connected properly. > > I've got the dial plan set up, I just dont know what command to use to send the email.Off the top of my head... exten = *,n,system(echo Call to ${DNIS} failed | mail -s 'Call failed' root at localhost) -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
I have this:
exten => s,n,System(/root/sendemail.sh shmaltz at gmail.com
"${STRFTIME(,,%c)}" "${CALLERID(name)} ${CALLERID(num)}"
${EPOCH})
/root/sendemail.sh:
#!/bin/sh
#$1 email address
#$2 time
#$3 CallerID
#$4 EPOCH
TMPFILE=/root/tmpemails/$4
echo "TO: "$1 >> $TMPFILE
echo "Subject: New call" >> $TMPFILE
echo ""
echo "Just wanted to let you know, you received a new call at
"$2",
from "$3"." >> $TMPFILE
echo "" >> $TMPFILE
echo "Thank you" >> $TMPFILE
echo "" >> $TMPFILE
echo "." >> $TMPFILE
/usr/sbin/sendmail $1 < $TMPFILE
rm $TMPFILE
hope this helps, make sure sendmail is configured to send emails, if
emails from voicemail.conf works right then this should work too.
On Wed, Oct 20, 2010 at 6:41 PM, Dan Journo
<dan at keshercommunications.com> wrote:> Hi,
>
>
>
> I'm sure this topic has been discussed before but i'm having
trouble finding
> a simple answer.
>
>
>
> Whats the easiest way of sending an email from Asterisk?
>
>
>
> I want to set up a warning so that after a Dial cmd, if the DIALSTATUS is
> CHANUNAVAIL, Asterisk sends an email to the admin to check the voip phone
is
> connected properly.
>
>
>
> I've got the dial plan set up, I just dont know what command to use to
send
> the email.
>
>
>
> Thanks
>
> Dan
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
> ? ? ? ? ? ? ? http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> ? http://lists.digium.com/mailman/listinfo/asterisk-users
>