Resolution and processing of Short Message receipt

Source: Internet
Author: User

The content to be forwarded is as follows, respecting the author's originality.

---------------------------------------------

Recently I am working on a receipt for short messages.ProgramI spent a lot of research efforts and found a lot of information. In addition to my own practical experiments and applications, I made a summary on the basis of my predecessors and added my own experience ,, in addition, I found that there are some errors about sms receipt on the Internet. I will introduce the pedicures I have prepared to you to help readers.
I. Hardware Interfaces
The GSM Modem supports the AT Instruction Set defined in gsm07.05 and gsm07.07. Connect to a computer through a serial port
Ii. Short Message receipt settings
At cnmi =, 1 // The newly received SMS is directly sent to the Te terminal and is not stored in the smcard. This is a key step. If it is set incorrectly, the SMS receipt may not be received, remember! The following describes its meaning:

at cnmi = , , , ,
parameter:
mode:
0 -- cache on the terminal
1 -- directly send to te
MT:
0 -- no event is returned if a new SMS is received
1 -- if the received SMS is stored in Na,
cmti: ,
2 -- in addition to class2 SMS, the new SMS is directly sent to the terminal and the following message is returned:
CMT:
3 -- class3 SMS Returns Using the MT = 2 method, and Other types Use the MT = 1 method.
BM:
0 -- no notification of Cell Broadcast
2 -- New Cell broadcast notification, return
CBM:
3 -- cell broadcast notification in class3 format, in the format of BM = 2
DS:
0 -- Status report not notified
1 -- New Status Report Notification, return:
CDS:
2 -- if the new status report is stored in me, return:
cdsi: ,
BRF:
1 -- always set to 1
3. Code
generally, the GSM Modem Hardware vendor, A piece of ready-made code is provided. You can set 11 to 31 in the Code. This must be set correctly. Otherwise, you cannot see the SMS receipt, below I will list the Delphi Code provided by the vendor.

Function tform_main.smssend (COMM: tcomm; csca, DST: string; content: widestring): Boolean;
VaR
S: string;
T: string;
L: integer;
TP: integer;
Begin
If csca = ''then
S: = '00'
Else
Begin
T: = '91 'telnumencode (csca );
Fmtstr (T, '% 2.2x % s', [length (t) Div 2, T]);
S: = T;
End;
L: = length (s) Div 2;
TP: = $11; // change 11 to 31.
TP: = TP or $80;
Fmtstr (T, '% 2.2x', [TP]);
S: = s t;
S: = s '00 ';

T: = telnumencode (DST );
Fmtstr (T, '% 2.2 X 91% s', [length (t)-count (T, 'F'), T]);
S: = s t;
S: = S' 000801 ';

If length (content)> max_sms_length then
Delete (content, max_sms_length 1, length (content)-max_sms_length );
T: = usc2encode (content );
Fmtstr (T, '% 2.2x % s', [length (t) Div 2, T]);
S: = s t;
Fmtstr (S, 'at cmgs = % d' #13 '% s' # $ 1A, [(length (s) Div 2)-L, S]);
Pushcmd (Comm, S );
Result: = true;
End;

Iv. Operations
Set cnmi on the Super Terminal
At + cnmi = 1, 1, 1
OK
After sending another text message and returning OK, the terminal will return the message about 5s.
CDS: 26
0006320d91684251734756f%6071415354005060714153640000

Section 1 000632
000632 indicates the total number of text messages that you send from activation to on. if you don't believe it, you can send two consecutive messages to see the incremental result. This is in hexadecimal format. 0d receiver number length
0d // receiver number length
91 // SMS center number type
682131710956f6 // recipient's number
50607141535400 // time when the message arrived at the SMS Center
5060714153640000 // time when the message is sent to the receiver

0006320d91684251734756f%6071415354005060714153640000
This message is sent by the sender returned by the SMS center to the recipient's SMS receipt. The next thing to do is to parse the receipt information. After the parity switch, the message is obtained as follows:

"The short message center received the message sent from this number to 2005 at '2017-06-17 14: 35: 45, '123' received the message sent by this number during '2017-06-17 14:35:46'

At this point, all the tasks of SMS receipt have been completed. The subsequent task is to resolve the mobile phone number when receiving the receipt, so that we can perform statistical analysis. It's easy, it's hard.
5. Experience
This article needs to be modified in two places. One is at cnmi =, and the other is: Change 11 in the code to 31. you can only modify these two items to receive SMS receipts. Otherwise, no receipt is returned. Simply put, it is imperative for China Mobile and China Unicom to get angry, because moeny is required to activate this business. Oh, no matter how it is done, the mission of SMS receipt is completed, I hope this will bring benefits to my friends who are seeking for this question, and I will not go wrong. This is my greatest wish!

Advertisement:
(Appendix: I have developed a set of SMS Group Sending software, which includes this function, but the entire set is for sale. If you are interested, you can download it and check it. If you are interested, contact me, if you have any questions, contact us for further discussion.
QQ: 352761910
E-mail: mzdf_info@163.com)

------------------------------

Another article about sms receiptArticleLocation in: http://blog.csdn.net/9527/archive/2007/02/06/1503482.aspx
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.