echo -ne "at+cmgs=101\r" >/dev/modem;sleep 1;echo -ne "0051000B919145557705F400F5AA570605040B8423F0DC0601AE02056A0045C60C033230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536000103616D757A6F2E636F6D2043472030303031000101^Z" >/dev/modem
00 default SMSC
51
00 message ID 00 means let phone set
0B length of destination mobile number = 11
91 the international + sign
0621723364F4 the phone number 60 12 27 33 46 4
00 protocol identifier
F5
AA validity period 4 days
57 length of content
06
05
04
0B84 dest port no
23F0 origin port no
DC Transaction ID (Push ID)
06 PDU type (Push PDU)
01 Header Length (just leave it at 01)
AE Content Type=application/vnd.wap.sic (0x80 | 0x2E)
02
05
6A
00
45
C6
0C http://
03 (next is an ASCII string for the URL, terminate with 00)
3230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536
which means = 202.9.98.54:8080/CGServer/serve.jsp?id=123456
00 terminate string with 00
01
03 (next is an ASCII string for title, terminate with 00)
616D757A6F2E636F6D2043472030303031
which means = amuzo.com CG 0001
00 terminate string with 00
01
01
Calculate the size of the payload message in Hex : (goes after AA)
This works:
echo -n "06 05 04 0B 84 23 F0 DC 06 01 AE 02 05 6A 00 45 C6 0C 03 32 30 32 2E 39 2E 39 38 2E 35 34 3A 38 30 38 30 2F 43 47 53 65 72 76 65 72 2F 73 65 72 76 65 2E 6A 73 70 3F 69 64 3D 31 32 33 34 35 36 00 01 03 61 6D 75 7A 6F 2E 63 00 01 01" |tr '[a-z]' '[A-z]' |sed 's/ / p /g' |sed 's/$/ p/'|awk '{print "16i "$0}'|dc |tr ' ' '\n' |awk '{printf("%c",$0)}'|wc -c |tr ' ' '\n'|awk '{printf "%x ",$1}'
4d
And this is an easier way:
echo -n 0605040B8423F0DC0601AE02056A0045C60C033230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536000103616D757A6F2E63000101 |wc -c |awk '{print $1" * .5"}'|bc |awk -F. '{printf "%x\n",$1}'
4d
Here is how to calculate the overall message length: (headers + payload)
echo -ne "51000B919145557705F400F5AA570605040B8423F0DC0601AE02056A0045C60C033230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536000103616D757A6F2E636F6D2043472030303031000101" |wc -c |awk '{print $1" * .5 "}'|bc |awk -F. '{print $1}'
101
1 comment:
I have a big problem.
I got the 101 for AT+CMGS=101.
But how did you get the 57 for content length cos I count the content minus header but I cannot get the 57 so my Wap push pdu is not received.
Post a Comment