Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Script example of sending SMS

 

#!/bin/bash
# Скрипт отправки SMS для версии SMS script ver. 2.4.x системы SkyControl
 
usage()
{
cat << EOF
usage: $0 options
 
OPTIONS:
   -?,-h   Show this message
   -H      Hostname or IP address
   -u      User name
   -p      Password
   -P      Phone for sending
   -m      Message for sending
EOF
}
 
HOSTIP=
USERNAME=
PASSWORD=
TOPHONE=
MESSAGE='Test'
 
while getopts “hH:u:p:P:m:” OPTION
do
     case $OPTION in
         h)
             usage
             exit 1
             ;;
         H)
             HOSTIP=$OPTARG
             ;;
         u)
             USERNAME=$OPTARG
             ;;
         p)
             PASSWORD=$OPTARG
             ;;
         P)
             TOPHONE=$OPTARG
             ;;
         m)
             MESSAGE=$OPTARG
             ;;
         ?)
             usage
             exit
             ;;
     esac
done
 
if [[ -z $HOSTIP ]] || [[ -z $USERNAME ]] || [[ -z $PASSWORD ]] || [[ -z $TOPHONE ]] || [[ -z $MESSAGE ]]
then
     usage
     exit 1
fi
 
# 1) хеш пароляHash
HASH=`echo -n ${PASSWORD} | openssl dgst -sha1 | awk '{print $NF}'`
 
# 2) авторизацияAutorisation
RESPONSE=`curl -s -d "querytype=auth&name=${USERNAME}&h=${HASH}" "${HOSTIP}/engine.htm"`
 
# 3) ключ сессииSession key
KEY=`echo -n  ${RESPONSE} | awk -F"\"" '{print $4}'`
 
# 4) отправить send SMS
curl
 -d "querytype=send_sms_message&k=${KEY}" --data-urlencode
"to_phone=${TOPHONE}" --data-urlencode "message=${MESSAGE}"
${HOSTIP}/engine.htm > /dev/null 2>&1

Section "Setting up GSM modem" for driver v2.0.1 - v2.2.5 can be found here:

Child pages (Children Display)

 

developer notes: linkchange

...