admin管理员组

文章数量:1642222

SMS 编码说明

PDU编码协议简单说明

接收:SMSC号码是+8613800250500,对方号码是13693092030,消息内容是你好!”。手机接收到的PDU串可以是

08 91 68 31 08 20 05 05 F0 84 0D 91 68 31 96 03 29 30 F0 00 08 30 30 21 80 63 54 80 06 4F 60 59 7D 00 21

对照规范,具体分析:

分段 含义 说明

08 地址信息的长度 个八位字节(包括91)

91 SMSC地址格式(TON/NPI) 用国际格式号码(在前面加‘+’)

68 31 08 20 05 05 F0 SMSC地址 8613800250500,补‘F’凑成偶数个

84 基本参数(TP-MTI/MMS/RP) 接收,无更多消息,有回复地址

0D 回复地址数字个数 13个十进制数(不包括91‘F’)

91 回复地址格式(TON/NPI) 用国际格式号码(在前面加‘+’)

68 31 96 03 29 30 F0 回复地址(TP-RA) 8613693092030,补‘F’凑成偶数个

00 协议标识(TP-PID) 是普通GSM类型,点到点方式

08 用户信息编码方式(TP-DCS) UCS2编码

30 30 21 80 63 54 80 时间戳(TP-SCTS) 2003-3-12 08:36:45  +8时区

06 用户信息长度(TP-UDL) 实际长度6个字节

4F 60 59 7D 00 21 用户信息(TP-UD) “你好!”

 

 

 

详细解析:

 0891683108200505F011190D91683105155694F50008FF10008FF044F60597D

 

 <1>短信中心地址字段: 0891

08Address-Lengt(地址长度),短信息中心地址长度为8个字节,是(91+ 683108200505F0)的长度,88位字节 

 91地址类型:1 001 0001      

Bit71。始终为1      

Bits 6,5,4Type-of-Number(号码类型):001,代表Internation Number。也即是号码前加“+”。注意:对某些比较特殊的号码,例如手机与小灵通的互通时,这里不能设置为001,而要设置成000,代表号码前没有“+”,否则无法接收。

 

下面是GSM03.40协议号码类型的解释:

 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 3,2,10Numbering-plan-identification(号码鉴别)0000—未知,0001—ISDN/电话号码(E.164/E.163)1111—留作扩展;一般默认为0001,表示电话号码类型的

 

下面是GSM03.40号码鉴别的解释:

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>短信中心号码:683108200805F0

   一个字节内反转,8613800280500,如果长度为奇数则需要加“F”补齐。比如号码为:+8613505165495,去掉"+"后在末尾添加F变为:8613505165495F,再将手机号码的奇数位和偶数位的相交换为683105155694F5

 

<3>FirstOctet字段:1119

(1)11      

 

包含TP-MTI(2bit)TP-RD(1bit)TP-VPF(2bit)TP-RP1bit),TP-UDHI(1bit)TP-SRR(1bit)

二进制表示形式:0 0 0 10 0 01

TP-MTI01 TP-Message-Type-Indicator(消息类型指示符)

Bit1,000—读出(Deliver; 01—提交(Submit

Bit1,001指示为SMS-SUBMIT类型

下面是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-RD0  TP-Reject-Duplicates(是否拒绝相同重复消息)

 

   Bit20—接受复制; 1—拒绝复制 

 Bit20   指示短消息中心接收未转发的具有相同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 previously 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  previously submitted SM from the same OA. In this case an  appropriate TP-FCS value will be returned in the SMS-SUBMIT-REPORT.

TP-VPF10   TP-Validity-Period-Format(有效期格式)

 

Bit4,3::00—不提供(Not present);01—预留;  10—整型(标准),指使用相对格式;11—提供8位字节的一半(Semi-Octet Represented

下面是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-SRR0    TP-Status-Report-Request

Bit5    1:需要报告,0:不需要报告。

Bit 5:

0       A status report is not requested

1       A status report is requested

TP-UDHI0   TP-User-Data-Header-Indicator(用户数据头标示)   Bit6   1:含头信息  0:不含头信息,指示这是一个SMS消息,没有用户数据头,EMS(增强消息业务)消息需要设置。图片铃声这些都是包含头部信息的.文本不包含头部信息

 

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-RP0     TP-Reply-Path(回复路径)   Bit7    1:设置回复路径,0:没有设置回复路径。

下面是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)消息参考值TP-MR (TP-Message-Reference):

19如果使用"00" 值代表让电话自己设置消息参考值.

 

<4> 对方号码字段:0D913105155694F5

    0D:目标地址数字个数,13个十进制数(不包括91‘F’)

    91:地址类型,同短信中心号码设置.

    3105155694F5:目标手机号码。

 

<5>上层协议标识TP-PID(TP-Protocol-Identifier)

00     一般设置为00,表示普通GSM,点对点  <6> 数据编码设置  TP-DCS(TP-Data-Coding-Scheme):08

指示TP-UD的编码方式。08代表Unicode方式。

参照GSM03.38协议:

Bit 3,2

00    Default alphabet

01    8 bit

10    UCS2 (16bit) [10]

11    Reserved

 

<7>有效期TP-VP(TP-Validity-Period):FF

FF表示最大。

 

<8> 用户数据长度TP-UDL(TP-User-Data-Length):4

      用户数据实际长度。注意不同编码下用户长度定义不同。

 

<9>用户数据 :4F60597D     "你好"Unicode编码

你:0x4F60;好:0x597D

 

 

 

 

本文标签: SMS