Currently, text and PDU (Protocol Data Unit) modes are commonly used to send short messages. Sending and receiving text messages in text mode is simple and easy to implement, but the biggest drawback is that you cannot send and receive Chinese text messages. PDU mode supports both Chinese text messages and English text messages. In PDU mode, messages can be sent and received in 7-bit, 8-bit, and ucs2 encoding formats. 7-bit encoding is used to send Common ASCII characters, 8-bit encoding is usually used to send data messages, and ucs2 encoding is used to send Unicode characters.
PDU Composition
PDU is composed of a string consisting of 0-9 and A-F. It looks like a group of hexadecimal numbers.
1: a pdu string sent by a mobile phone
08916830000200505f011108d91683105151094f50008ff10008ff044f60597d
<1> SMS center address field: 0891
08: Address-lengt (address length). The length of the central address of the short message is 8 bytes, which is the length of (91) + (6830000200505f0), and 8 8 bytes.
91 URL type: 10010001 bit7: 1. Always 1 bits 6, 5, 4: type-of-number (number type): 001, representing the internation number. That is, add "+" before the number ". Note: For some special numbers, for example, when a mobile phone is connected to PHS, it cannot be set to 001, but to 000, which indicates that there is no "+" before the number ", otherwise, it cannot be received.
The following is an explanation of the number type of the gsm03.40 protocol:
0 0 0 unknown
0 0 1 international number
0 1 0 national number
0 1 1 Network specific number
1 0 0 subscriber number
1 0 1 alphanumeric (coded according to ts03.38 7-bit default alphabet)
1 1 0 abbreviated number
1 1 1 reserved for extension
Ll not interpret reserved values but will store them as received.
Bits 0000, 1111: Numbering-plan-identification (number identification), 0001-unknown, 0001-isdn/phone number (e.164/e.163),-reserved for extension; generally, the default value is, indicates the phone number type. The following is an explanation of the identification of the gsm03.40 Number:
Bits3 2 1 0
0 0 0 0 unknown
0 0 0 1 ISDN/telephone numbering plan (e.164/e.163)
0 0 1 1 Data Numbering Plan (x.121)
0 1 0 0 telex numbering plan
1 0 0 0 National Numbering Plan
1 0 0 1 private numbering plan
1 0 1 0 ERMES Numbering Plan (ETSI de/PS 3 01-3)
1 1 1 1 reserved for extension
All other values are reserved.
<2> SMS center number: 683104200805f0
The length of a byte is reversed to 8613800280500. If the length is an odd number, add "F. For example, if the number is: + 8613505165495, remove "+" and add "F" to the end to "8613505165495f". Then, replace the odd and even digits of the mobile phone number with "683105154254f5 ".
<3> firstoctet field: 1119
(1) 11 contains TP-MTI (2bit), TP-RD (1bit), TP-VPF (2bit), TP-RP (1bit), TP-UDHI (1bit), TP-SRR (1bit)
Binary representation: 0 0 0 10 0 01
TP-MTI: 01 TP-message-type-indicator (Message Type Indicator)
Bit1, 0: 00-read (deliver); 01-submit (submit)
Bit1, 0: 01 indicates SMS-SUBMIT type
The following is the explanation of gsm03.40:
Bit1 bit0 Message Type
0 0 SMS-DELIVER (in the direction SC to MS)
0 0 SMS-DELIVER report (in the direction MS to SC)
1 0 SMS-STATUS-REPORT (in the direction SC to MS)
1 0 SMS-COMMAND (in the direction MS to SC)
0 1 SMS-SUBMIT (in the direction MS to SC)
0 1 SMS-SUBMIT-REPORT (in the direction SC to MS)
1 1 reservedtp-rd: 0 TP-reject-Duplicates (whether to reject identical duplicate messages)
Bit2: 0-copy accepted; 1-copy denied
Bit2: 0 indicates that the message center receives messages that are not forwarded with the same TP-MR.
Bit 2:
0 instruct the SC to accept an SMS-SUBMIT for an SM still held in the SC which has the same TP-MR and the same TP-DA as a previusly submitted Sm from the same OA.
1 instruct the SC to reject an SMS-SUBMIT for an SM still held in the SC which has the same TP-MR and the same TP-DA as the previusly submitted Sm from the same OA. in this case an appropriate TP-FCS value will be returned in the SMS-SUBMIT-REPORT.
TP-VPF: 10 TP-validity-period-format (validity period format)
Bit4, 3: 00-not provided (not present); 01-reserved; 10-INTEGER (standard), which indicates that the relative format is used; 11-provide half of the 8-bit bytes (semi-octet represented)
The following is the explanation of gsm03.40:
Bit4 bit3
0 0 TP-VP field not present
1 0 TP-VP field present and integer represented (relative)
0 1 Reserved
1 1 TP-VP field present and semi-octet represented (absolute)
TP-SRR: 0 TP-status-report-Request
Bit5: 1: Report required; 0: report not required.
Bit 5:
0 a status report is not requested
1 A status report is requested
TP-UDHI: 0 TP-user-data-header-indicator (user data header identifier) bit6: 1: Header Information 0: header information not included, indicating this is an SMS message, no user data header, you need to set EMS (enhanced message service) messages. The image ringtones contain the header information. The text does not contain the header information.
Bit 6
0 The TP-UD field contains only the short message
1 The Beginning of the TP-UD field contains a header in addition to the short message
TP-RP: 0 TP-reply-path (reply path) bit7: 1: Set reply path, 0: No set reply path.
The following is the explanation of gsm03.40:
Bit 7:
0: TP-reply-path parameter is not set in this SMS-SUBMIT/deliver
1: TP-reply-path parameter is set in this SMS-SUBMIT/deliver
(2) Message Reference Value TP-MR (TP-message-reference): 19 if the "00" value is used, the phone sets the message reference value.
<4> peer number field: 0d913105152.164f5
0d: number of target address numbers. A total of 13 decimal numbers (excluding 91 and 'F ')
91: Address type, same as the SMS center number.
3105152.164f5: The target mobile phone number.
<5> upper-layer protocol identification TP-PID (TP-Protocol-identifier): 00
Generally set to 00, indicating general GSM, point-to-point <6> data encoding settings TP-DCS (TP-data-coding-Scheme): 08
Indicates the encoding method of the TP-UD. 08 represents the Unicode mode. Refer to the gsm03.38 protocol:
Bit 3, 2
00 default alphabet
01 8 bit
10 ucs2 (16bit) [10]
11 Reserved
<7> validity period TP-VP (TP-validity-period): FF
FF indicates the maximum value.
<8> TP-UDL (TP-user-data-length): 4
The actual length of user data. Note that the user length is defined differently under different codes.
<9> User Data: 4f60597d "hello" unicode encoding
You: 0x4f60; good: 0x597d
2: PDU string received by the mobile phone
0891683109200505f0040d91683105151094f5000850208151754500044f60597d
<1> text message center address field: 08916830000200505f0, that is, + 8613800250500
<2> firstoctet: 04 its binary code: 00000100
TP-MTI: 00
TP-MMS (TP-more-message-to-send): 1 The SMS center has no more messages to send
TP-SRI: 0
TP-UDHI: 0
TP-RP: 0
<3> Sender number: 0d91683105151094f5 + 8613505165495
<4> protocol identifier: 00 TP-DCS point-to-point
<5> encoding method: 08 TP-DCS unicode encoding
<6> SMS center time: 50208151754500
Byte reversal 05/02/18 15:57:45 the last 00 represents the time zone, where 0
<7> User Data Length: 4
<8> User Data: 4f60597d
Chinese "hello" unicode encoding
References: <1> gsm03.40 Protocol
<2> Field Analysis and Implementation of Short Message PDU