SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Mon Mar 01, 2021 07:30
SMSTools3 Community » Help and support Bottom

[answered] Call Alert

  This topic is locked

Page:  1

Author Post
Member
Registered:
Nov 2010
Location: Sindh, Pakistan
Hi,

Please correct a following script:

#!/bin/bash


COUNTRY_CODE="91"
ADMIN_TO="03212911018"
EMAIL_GROUP="itops@mblonline.com"
EMAIL_FROM="sms@mblonline.com"
EMAIL="sysadmin@mblonline.com"
MAIL="/bin/mail"


send_sms()
{

        FILE=`mktemp /tmp/send_XXXXXX`
        echo "To: $1" >> $FILE
        if [ "x$3" != "x" ]; then
                echo "Provider: $3" >> $FILE
        fi
        echo "Comment: MBL auto-answer" >> $FILE
        echo "" >> $FILE
        echo -n "$2" >> $FILE
        FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX`
        mv $FILE $FILE2

}

DATE=`date +"%Y-%m-%d %H:%M:%S"`
FROM=`formail -zx From: < $2`
FROM_TOA=`formail -zx From_TOA: < $2`
MODEM=`formail -zx Modem: < $2`
TEXT=`sed -e '1,/^$/ d' < $2`

if [ "$1" = "CALL" ]; then
        if [ "x$FROM" != "x" ]; then
                if [ "${FROM:0:1}" = "0" ]; then
                        FROM="$COUNTRY_CODE${FROM:1}"
                fi

                send_sms "$FROM" "This Number only accept SMS"

                if [ "x$ADMIN_TO" != "x" ]; then
                send_sms "$ADMIN_TO" "Got a call from $FROM at $DATE"
                SUBJECT=Got a Missed call from ${SUBJECT//FROM/$FROM}
                message="From: $EMAIL_FROM"
                Subject: $SUBJECT
                $MAIL -s "${SUBJECT}" "${EMAIL}"

               fi
        fi
fi

exit 0
 
 
'bash' Syntax Highlight powered by GeSHi


OUTPUT OF SCRIPT:

./smsd_eventhandler-missedcall.sh: line 29: $2: ambiguous redirect
./smsd_eventhandler-missedcall.sh: line 30: $2: ambiguous redirect
./smsd_eventhandler-missedcall.sh: line 31: $2: ambiguous redirect
./smsd_eventhandler-missedcall.sh: line 32: $2: ambiguous redirect

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
You are calling the script without arguments. When testing, call the script like:
./smsd_eventhandler-missedcall.sh CALL /path/to/your/sample-sms-file

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.