keywords: ip pbx voip gateway gsm gateway

×

Notice

The forum is in read only mode.
× Questions about G400/G410 Cards.

how can send long sms

12 years 1 month ago #7893 by liaoweijun2012
如题

如何通过G400P发送长短信息(普通短信息发送没有问题)
12 years 1 month ago #7894 by Joe.Yung
Hi,
当前sms 的文本模式支持140个字节,PDU支持70个字节。对于超出的部分如何发送,建议编写一个这样的一个脚本:

计算当前输入的字符长度,默认发送前140个,超出的部分自动截取下一组140个字节作为下一次发送。以此类推.

如果需要,可以提供一个demo script.

12 years 1 month ago #7895 by Joe.Yung
Hello, please refer to the following example of sending long SMS by OpenVox G400P/G400E.

The whole SMS will be cut into one group or more groups of 140 bytes.

#!/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

If you have any question about it. Please contact me!

Attachments:
12 years 1 month ago #7901 by Easy
The best way would be to use PDU feature for that. If You encode Your message to PDU, You will get multiple PDU strings to send. Almost every cell phone on the market (but not G400P card, as I wrote earlier) is able to concatenate such messages and show them as one long message.If You use Python, please refer to:
http://minimoesfuerzo.org/2010/04/18/python-messaging-sms-encoderdecoder-masses/

You will find similar languages in another programming languages if needed.
Time to create page: 0.043 seconds
Powered by Kunena Forum