NSLU2-Linux
view · edit · print · history

Optware.AsteriskMissedCallEmailNotification History

Hide minor edits - Show changes to markup

April 23, 2009, at 04:22 PM by cdoban -- h extension needs to be used only in regular contexts
Changed lines 5-6 from:

You can add the h extension in any regular context you want email notifications for missing calls:

to:

You can add the h extension in any regular context you want email notifications for missed calls:

Changed line 8 from:

exten => h,1,System(asterisk-ic "my@email.net" "${CALLERID(num)}" "${CALLERID(name)}" "${DIALSTATUS}" "${VMSTATUS}" "${ARG1?}")

to:

exten => h,1,System(asterisk-ic "my@email.net" "${CALLERID(num)}" "${CALLERID(name)}" "${DIALSTATUS}" "${VMSTATUS}" "${EXTEN}")

April 23, 2009, at 03:59 PM by cdoban -- fix: h extension cannot be called from macro
Changed lines 4-5 from:

You can call the script from the h extension of the stdexten macro:

to:

The missing call email notification script needs to be called on the hangup extension "h". You can add the h extension in any regular context you want email notifications for missing calls:

January 12, 2009, at 04:21 PM by cdoban -- updated the missing call email notification script
Added line 40:

FROMEMAIL="your_sending@email.net"

Added line 82:

From: ${FROMEMAIL}

January 11, 2009, at 11:13 PM by cdoban -- updated the missing call email notification script
Changed lines 40-41 from:

SUBJECT="[PBX] Incoming call"

to:

SUBJECT="[PBX] Incoming call for extension ${EXTEN}"

January 11, 2009, at 11:05 PM by cdoban -- updated the missing call email notification script
Changed line 64 from:
                BODY="[ ${DIALSTATUS} ] ${CALLERIDNAME} ($CALLERIDNUM}) hung up on vm."
to:
                BODY="[ ${DIALSTATUS} ] ${CALLERIDNAME} (${CALLERIDNUM}) hung up on vm."
January 11, 2009, at 10:53 PM by cdoban -- added extension as the 6 parameter
Changed line 7 from:

exten => h,1,System(asterisk-ic "my@email.net" "${CALLERID(num)}" "${CALLERID(name)}" "${DIALSTATUS}" "${VMSTATUS}")

to:

exten => h,1,System(asterisk-ic "my@email.net" "${CALLERID(num)}" "${CALLERID(name)}" "${DIALSTATUS}" "${VMSTATUS}" "${ARG1?}")

Added line 13:
Changed lines 21-22 from:

if [ $# != 5 ]

to:
  1. $6 extension

if [ $# != 6 ]

Changed lines 33-34 from:
to:

EXTEN=$6

Changed line 39 from:

EMAILCMD="/opt/sbin/sendmail -t"

to:

EMAILCMD="/usr/sbin/sendmail -t"

Changed lines 43-44 from:

if [ $DEBUG -eq 1 ]; then

        echo $1 $2 \"$3\" $4 $5 >> $LOGFILE
to:

if [ ${DEBUG} -eq 1 ]; then

        echo $1 $2 \"$3\" $4 $5 $6 >> ${LOGFILE}
Changed line 48 from:

if [ "$EMAIL" = "" ]; then

to:

if [ "${EMAIL}" = "" ]; then

Changed line 52 from:

if [ $DIALSTATUS = "CANCEL" ]; then

to:

if [ ${DIALSTATUS} = "CANCEL" ]; then

Changed lines 54-55 from:

elif [ $DIALSTATUS = "ANSWER" ]; then

        BODY="$CALLERIDNAME ($CALLERIDNUM) was answered by $PEERNAME."
to:

elif [ ${DIALSTATUS} = "ANSWER" ]; then

        BODY="${CALLERIDNAME} (${CALLERIDNUM}) was answered by ${EXTEN}."
Changed line 57 from:
        BODY=" ${DIALSTATUS}  ${CALLERIDNAME} (${CALLERIDNUM}) hung up."
to:
        BODY="[ ${DIALSTATUS} ] ${CALLERIDNAME} (${CALLERIDNUM}) hung up."
Changed lines 59-60 from:
        if [ $VMSTATUS = "USEREXIT" ]; then
                BODY="[ ${DIALSTATUS} ] $CALLERIDNAME ($CALLERIDNUM) hung up on vm."
to:
        if [ ${VMSTATUS} = "USEREXIT" ]; then
                BODY="[ ${DIALSTATUS} ] ${CALLERIDNAME} (${CALLERIDNUM}) hung up on vm."
Changed lines 63-64 from:
        if [ $VMSTATUS = "FAILED" ]; then
                BODY="[ ${DIALSTATUS} ] $CALLERIDNAME ($CALLERIDNUM) hung up on vm."
to:
        if [ ${VMSTATUS} = "FAILED" ]; then
                BODY="[ ${DIALSTATUS} ] ${CALLERIDNAME} ($CALLERIDNUM}) hung up on vm."
Changed line 67 from:
        if [ $VMSTATUS = "SUCCESS" ]; then
to:
        if [ ${VMSTATUS} = "SUCCESS" ]; then
Changed lines 73-74 from:

if [ $DEBUG -eq 1 ]; then echo "To: $EMAIL Subject: $SUBJECT $BODY" >> $LOGFILE

to:

if [ ${DEBUG} -eq 1 ]; then echo "To: ${EMAIL} Subject: ${SUBJECT} ${BODY}" >> ${LOGFILE}

Changed lines 78-84 from:

if [ $SENDMAIL -eq 1 ]; then $EMAILCMD <<INLINE To: $EMAIL Subject: $SUBJECT

$BODY

to:

if [ ${SENDMAIL} -eq 1 ]; then ${EMAILCMD} <<INLINE To: ${EMAIL} Subject: ${SUBJECT}

${BODY}

January 05, 2009, at 05:43 PM by cdoban -- AsteriskMissedCallEmailNotification
Changed line 36 from:

EMAILCMD="/usr/sbin/sendmail -t"

to:

EMAILCMD="/opt/sbin/sendmail -t"

January 03, 2009, at 08:30 PM by cdoban -- added missed call notification email
Changed line 6 from:

[=

to:

[@

Changed lines 8-9 from:

=]

to:

@]

Changed line 12 from:

[=

to:

[@

Changed lines 89-90 from:

=]

to:

@]

January 03, 2009, at 08:28 PM by cdoban -- added missed call email notification
Changed line 1 from:

Here is a variation of the missing call email notification script done by Matt Schmandt (http://www.theschmandts.org/blog/2007/05/05/email-notifications-for-missed-calls-in-asterisk/)

to:

Here is a variation of the missing call email notification script done by Matt Schmandt (http://www.theschmandts.org/blog/2007/05/05/email-notifications-for-missed-calls-in-asterisk/).

Added line 3:
Added line 6:

[=

Changed lines 8-9 from:
to:

=]

Added line 12:

[=

Added lines 89-90:

=]

January 03, 2009, at 08:23 PM by cdoban -- Missed Call Email Notification
Added lines 1-85:

Here is a variation of the missing call email notification script done by Matt Schmandt (http://www.theschmandts.org/blog/2007/05/05/email-notifications-for-missed-calls-in-asterisk/) This will give the expected result also for the case when the called phone is not registered or is busy. You can call the script from the h extension of the stdexten macro:

exten => h,1,System(asterisk-ic "my@email.net" "${CALLERID(num)}" "${CALLERID(name)}" "${DIALSTATUS}" "${VMSTATUS}")

Here is the script:

  1. !/bin/sh
  2. Used for email alerting of incoming calls
  3. $1 email address
  4. $2 callerid num
  5. $3 callerid name
  6. $4 dial status
  7. $5 vm status

if [ $# != 5 ] then exit 1 fi

  1. Store command line args in nice variables

EMAIL=$1 CALLERIDNUM=$2 CALLERIDNAME=$3 DIALSTATUS=$4 VMSTATUS=$5

DEBUG=0 #Set to 0 for standard operation. 1 will log inputs and mail commands for debugging. LOGFILE="/var/log/asterisk/IncomingCalls?.log"

SENDMAIL=1 #Set to 1 if you want it to email the alert. 0 is useful for debugging. EMAILCMD="/usr/sbin/sendmail -t" SUBJECT="[PBX] Incoming call"

  1. log mail command

if [ $DEBUG -eq 1 ]; then

        echo $1 $2 \"$3\" $4 $5 >> $LOGFILE

fi

  1. Check we have an email address if not quit

if [ "$EMAIL" = "" ]; then

        exit 0

fi

if [ $DIALSTATUS = "CANCEL" ]; then

        BODY="${CALLERIDNAME} (${CALLERIDNUM}) hung up."

elif [ $DIALSTATUS = "ANSWER" ]; then

        BODY="$CALLERIDNAME ($CALLERIDNUM) was answered by $PEERNAME."

else

        BODY=" ${DIALSTATUS}  ${CALLERIDNAME} (${CALLERIDNUM}) hung up."
        #check for hangup in vm menu.  ex call went to vm and user hung up
        if [ $VMSTATUS = "USEREXIT" ]; then
                BODY="[ ${DIALSTATUS} ] $CALLERIDNAME ($CALLERIDNUM) hung up on vm."
        fi
        #check for hangup in vm menu.  ex call went to vm and user hung up
        if [ $VMSTATUS = "FAILED" ]; then
                BODY="[ ${DIALSTATUS} ] $CALLERIDNAME ($CALLERIDNUM) hung up on vm."
        fi
        #if they left a vm we already would get an email.  Don't need a 2nd
        if [ $VMSTATUS = "SUCCESS" ]; then
                exit 0
        fi

fi

  1. log mail command

if [ $DEBUG -eq 1 ]; then echo "To: $EMAIL Subject: $SUBJECT $BODY" >> $LOGFILE fi

  1. send email

if [ $SENDMAIL -eq 1 ]; then $EMAILCMD <<INLINE To: $EMAIL Subject: $SUBJECT

$BODY

Asterisk PBX

INLINE fi

exit 0

view · edit · print · history · Last edited by cdoban.
Originally by cdoban.
Page last modified on April 23, 2009, at 04:22 PM