- Thank you received: 0
keywords: ip pbx voip gateway gsm gateway
#!/bin/sh
# Example of sending long SMS by OpenVox GSM card.
#####################################################
# The following parameters should be input to yours!
#####################################################
# SMS Content(s)
SMS_CONTENTS="123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
# SPAN Number(s)
SPAN=1
# Destination Number(s)
NUMBER=15623841257
# SMS Center Number.
#SMSC= 1380075500 #Shenzhen China
#Sending MODE: pdu or text
MODE=text
######################################################
# The following should not be edited by users!!!
######################################################
# Set up sending methods
if [ $MODE = text ];then
# Defaut length of TEXT mode
LIMIT=140
asterisk -rx "gsm set send sms mode text"
else
# Default length of PDU mode
LIMIT=70
asterisk -rx "gsm set send sms mode pdu"
fi
# Count the length of whole SMS
LENGTH=${#SMS_CONTENTS}
# Groups of sending time(s)
TIMES=$(($LENGTH / $LIMIT))
# The remaining length of SMS
LAST=$(($LENGTH % $LIMIT))
if [ $LAST -eq 0 ];then
# Notes
SEND_TIMES=$TIMES
else
SEND_TIMES=$(($TIMES+1))
fi
echo -----------------------------------------------------------------------
echo "Please note: Your SMS will be separted to $SEND_TIMES section(s) to send!"
echo -----------------------------------------------------------------------
for((i=0; i<$TIMES; i++)) do
S=$(($i*$LIMIT))
REAL_CONTENT=${SMS_CONTENTS:$S:$LIMIT}
asterisk -rx "gsm send sms $SPAN $NUMBER \"$REAL_CONTENT\""
echo $(($i + 1))
done
if [ $LAST -ne 0 ]; then
S=$(($LENGTH - $LAST))
REAL_CONTENT=${SMS_CONTENTS:$S:$LAST}
asterisk -rx "gsm send sms $SPAN $NUMBER \"$REAL_CONTENT\""
echo $(($TIMES + 1))
fi