wright_wu 发表于 2010-9-15 10:04:03

谈谈短消息的种类

短消息的种类
        在我们手机的基本网络功能测试中,主要包括语音呼叫、短消息、网页浏览等等,今天主要谈谈短消息这一功能模块。
        在我们平时的使用以及测试中,碰到过很多种类的消息,比如短消息、彩信、Push消息、广播消息、USSD……
        今天我们来简单罗列一下短消息的种类,它们基本上都承载于GSM,当然有些也可以承载于GPRS, 可以这样来划分:
1.        Normal SMS
即普通类型的短消息,也是我们平时发送和接收最多的。可以被正常保存在手机或者SIM卡里面的普通文字短消息, 通过抓空口消息我们可以清楚的知道本条短消息的类型.

MOD_L1->MOD_AS | L1_AS_SAP | FN: 762420 | T=442242 | MSG_ID_LAPDM_RR_DATA_IND | BS => MS //手机端接收的短消息
Channel_Type=SDCCH//短消息传输信道
>l3sms tif=0 ti=1 N(SD)=0   CP_DATA   :
            RP-DATABS->MS   (RP-MTI=1)
             RP-Message Reference = 0
             RP-Originator Address:
                    Type of Number = International number
                    ISDN/telephony Numbering plan (Rec. E.164/E.163)
                    Num SC = 8613800210500 // 短消息中心
             RP-Destination Address: length = 0
             == RP-User Data: ===== SMS-DELIVER: (TP-MTI=0)
             TP-MMS=1: No More messages are waiting for the MS in this SC
             TP-SRI=0: A status report will not be returned to the SME //短消息状态报告(deliver report),没有
             TP-UDHI=0: TP-UD field contains only the Short Message
             TP-RP =0: TP-Reply-Path parameter is not set in this SMS-DELIVER // 回复路径(reply path), 不需要
             TP-OA:
                      Type of Number = International number
                      ISDN/telephone Numbering plan (Rec. E.164/E.163)
                      -- If it's a normal message :
                      Length = 13 semi-octet(s)
                      Num = 8613817803555 // 接收终端号码
             TP-PID=00h: No interworking, but SME-to-SME protocol
             TP-DCS=00h:
                                // TP-PID 和 TP-DCS 这两个参数组合起来,可以判断本条是一普通的短消息.
                    The text is uncompressed
                     Alphabet = Default Alphabet
             TP-SCTS:
                    November 28th 06
                    15h 13m 35s        Time Zone: GMT + 8h0m (23h=32) // 短消息到达消息中心的时间戳
             TP-UDL = 24 (18h) // 短消息长度, 24 bytes
             TP-UD (SMS Message):   ("Default 7 bit Alphabet") // 短消息编码方式
             Text : smstest:sendwithGPRS// 短消息文本内容

2.        Class SMS
a.        Class 0
b.        Class 1
c.        Class 2
d.        Class 3

2.1        Class 0: 自动显示在手机终端上,无论手机或者SIM的容量是否已满,但是不能自动保存在手机或者SIM卡上。(可以称作 闪信,现在也有些手机终端也会提供手动保存的功能。)
MOD_L1->MOD_AS | L1_AS_SAP | FN: 808002 | T=487824 | MSG_ID_LAPDM_RR_DATA_IND | BS => MS
Channel_Type=SDCCH
>l3sms tif=0 ti=1 N(SD)=0   CP_DATA   :
            RP-DATABS->MS   (RP-MTI=1)
             RP-Message Reference = 0
             RP-Originator Address:
                    Type of Number = International number
                    ISDN/telephony Numbering plan (Rec. E.164/E.163)
                    Num SC = 8613800210500
             RP-Destination Address: length = 0
             == RP-User Data: ===== SMS-DELIVER: (TP-MTI=0)
             TP-MMS=1: No More messages are waiting for the MS in this SC
             TP-SRI=0: A status report will not be returned to the SME
             TP-UDHI=0: TP-UD field contains only the Short Message
             TP-RP =0: TP-Reply-Path parameter is not set in this SMS-DELIVER
             TP-OA:
                      Type of Number = International number
                      ISDN/telephone Numbering plan (Rec. E.164/E.163)
                      -- If it's a normal message :
                      Length = 13 semi-octet(s)
                      Num = 8613817803555
             TP-PID=00h: No interworking, but SME-to-SME protocol
             TP-DCS=10h:
                    The text is uncompressed
                     Message Class = Class 0
                     Alphabet = Default Alphabet
             TP-SCTS:
                    November 28th 06
                    15h 17m 05s        Time Zone: GMT + 8h0m (23h=32)
             TP-UDL = 11 (0Bh)
             TP-UD (SMS Message):   ("Default 7 bit Alphabet")
             Texte : smsclass0
2.2        Class 1: 保存的方式和Normal SMS一样,由用户手动设置决定手机或者SIM卡.
TP-PID=00h: No interworking, but SME-to-SME protocol
             TP-DCS=11h:
                    The text is uncompressed
                     Message Class = Class 1 (Default meaning: ME-specific)
                     Alphabet = Default Alphabet
2.3        Class 2: 默认保存在SIM卡上,当SIM卡慢应该提示一些协议错误等提示信息,但是现在许多手机终端厂商做成优先保存在SIM卡,当SIM卡满后,自动保存到手机中.
TP-PID=00h: No interworking, but SME-to-SME protocol
             TP-DCS=12h:
                    The text is uncompressed
                     Message Class = Class 2 SIM-specific message
                     Alphabet = Default Alphabet
2.4        Class 3: 直接保存到PC上,如果手机和PC没有连接,按照Class 1执行.
TP-PID=00h: No interworking, but SME-to-SME protocol
             TP-DCS=13h:
                    The text is uncompressed
                     Message Class = Class 3 (Default meaning: TE-specific)
                     Alphabet = Default Alphabet

3.        Replace SMS
a.        Replace type 1
b.        Replace type 2
c.        Replace type 3
d.        Replace type 4
e.        Replace type 5
f.        Replace type 6
g.        Replace type 7

3.1        Replace这种类型的短消息,主要特点是当TP-PID和TP-DCS一样的时候,可以将之前的短消息内容更新至最新收到的. 至于Replace 1~7 只是表示7种类型,没有什么特殊的含义。需要提的一点是Replace SMS主要由TP-PID来决定,但可以和TP-DCS配合使用.
MOD_L1->MOD_AS | L1_AS_SAP | FN: 791282 | T=471104 | MSG_ID_LAPDM_RR_DATA_IND | BS => MS
Channel_Type=SDCCH
>l3sms tif=0 ti=1 N(SD)=0   CP_DATA   :
            RP-DATABS->MS   (RP-MTI=1)
             RP-Message Reference = 0
             RP-Originator Address:
                    Type of Number = International number
                    ISDN/telephony Numbering plan (Rec. E.164/E.163)
                    Num SC = 8613800210500
             RP-Destination Address: length = 0
             == RP-User Data: ===== SMS-DELIVER: (TP-MTI=0)
             TP-MMS=1: No More messages are waiting for the MS in this SC
             TP-SRI=0: A status report will not be returned to the SME
             TP-UDHI=0: TP-UD field contains only the Short Message
             TP-RP =0: TP-Reply-Path parameter is not set in this SMS-DELIVER
             TP-OA:
                      Type of Number = International number
                      ISDN/telephone Numbering plan (Rec. E.164/E.163)
                      -- If it's a normal message :
                      Length = 13 semi-octet(s)
                      Num = 8613817803555
             TP-PID=42h: Replace Short Message Type 2
             TP-DCS=00h:
// 可以判断这是一条Normal SMS类型的Replace 2 短消息.
                    The text is uncompressed
                     Alphabet = Default Alphabet
             TP-SCTS:
                    November 28th 06
                    15h 15m 48s        Time Zone: GMT + 8h0m (23h=32)
             TP-UDL = 14 (0Eh)
             TP-UD (SMS Message):   ("Default 7 bit Alphabet")
             Text : testreplace2
4.        Message type 0
这种类型的短消息,终端用户是感觉不到的,因为它是不会在上层显示给用户看到的,在手机后端收到后要立即删除掉,只是表示手机支持本类型消息的能力而已.

wright_wu 发表于 2010-9-15 10:04:41

5.        WAP Push Message
这种类型的消息我们实际应用中碰到还是很多的,比如我们将彩信设置成手动接收或者彩信自动接收失败,会收到一条有彩信在彩信中心的短消息通知;还有就是某个网站会主动推送一条Push Message给手机终端,某某地方有打折信息、好的图书…;Push Mail邮件接收服务,当邮箱账户内一旦有新邮件到达,可以采用的一种方案是先推送一条Push Message给手机终端给予提示.
所以这些消息中,有两个主要的共性: 一是通过短消息途径传送;二是消息体中包含URL链接.
下面我们看一个彩信的Notification (wap push message)消息:
MOD_L1->MOD_AS | L1_AS_SAP | FN: 2044199 | T=1020595 | MSG_ID_LAPDM_RR_DATA_IND | BS => MS
Channel_Type=SDCCH
>l3sms tif=0 ti=1 N(SD)=0   CP_DATA   :
            RP-DATABS->MS   (RP-MTI=1)
             RP-Message Reference = 0
             RP-Originator Address:
                    Type of Number = International number
                    ISDN/telephony Numbering plan (Rec. E.164/E.163)
                    Num SC = 8613800210500
             RP-Destination Address: length = 0
             == RP-User Data: ===== SMS-DELIVER: (TP-MTI=0)
             TP-MMS=1: No More messages are waiting for the MS in this SC
             TP-SRI=0: A status report will not be returned to the SME
             TP-UDHI=1: TP-UD field contains a header + the Short Message
             TP-RP =0: TP-Reply-Path parameter is not set in this SMS-DELIVER
             TP-OA:
                      Type of Number = National number
                      ISDN/telephone Numbering plan (Rec. E.164/E.163)
                      -- If it's a normal message :
                      Length = 5 semi-octet(s)
                      Num = 90022
             TP-PID=00h: No interworking, but SME-to-SME protocol
             TP-DCS=04h:
                    The text is uncompressed
                     Alphabet = 8 bit
             TP-SCTS:
                    November 28th 06
                    16h 52m 03s        Time Zone: GMT + 8h0m (23h=32)
             TP-UDL = 139 (8Bh)
             TP-UD (SMS Message):   ("8 bit Alphabet")
               TP-UDHL length = 6 (06h)
                      Application port adressing scheme, 16 bits address : IEI= 05h
                      Length: 0x4 (4)
                      Destination Port:
                          Port Number: 0x0b84(2948)
                          Meaning: As allocated by IANA
                      Originator Port:
                          Port Number: 0x23f0(9200)
                          Meaning: As allocated by IANA
            WSP Data Unit Structure
               TID = 0x30
               PDU Type = Push (0x06)
               Length (Header + ContentType) = 36
               ContentType: 0x616170706c69636174696f6e2f766e642e7761702e6d6d732d6d657373616765
               application/vnd.wap.mms-message
               Header:
               (0xb487)
                   Push-Flag : 7
               (0xaf84)
                   X-Wap-Application-Id :FFFFFF84
             *** MMS Header ***
               X-Mms-Message-Type: m-notification-ind (0x82)
               X-Mms-Transaction-ID: cQ0G5FiedAQA
               X-Mms-MMS-Version: 1.0 (0x90)
               X-Mms-Content-Location: http://211.136.112.84/cQ0G5FiedAQA
               X-Mms-Expiry (relative):0x302a2eb => 1 year(s) 7 month(s) 8 day(s), 13:00:27
               From (address-present):13621981888/TYPE=PLMN
               X-Mms-Message-Class: Personal (0x80)
               X-Mms-Message-Size: 72597 bytes
             *** No MMS Body ***

wright_wu 发表于 2010-9-15 10:05:02

6.        Voice Mail Message
就是语音留言的提示消息.
MOD_L1->MOD_AS | L1_AS_SAP | FN: 833522 | T=513344 | MSG_ID_LAPDM_RR_DATA_IND | BS => MS
Channel_Type=SDCCH
>l3sms tif=0 ti=1 N(SD)=0   CP_DATA   :
            RP-DATABS->MS   (RP-MTI=1)
             RP-Message Reference = 0
             RP-Originator Address:
                    Type of Number = International number
                    ISDN/telephony Numbering plan (Rec. E.164/E.163)
                    Num SC = 8613800210500
             RP-Destination Address: length = 0
             == RP-User Data: ===== SMS-DELIVER: (TP-MTI=0)
             TP-MMS=1: No More messages are waiting for the MS in this SC
             TP-SRI=0: A status report will not be returned to the SME
             TP-UDHI=0: TP-UD field contains only the Short Message
             TP-RP =0: TP-Reply-Path parameter is not set in this SMS-DELIVER
             TP-OA:
                      Type of Number = International number
                      ISDN/telephone Numbering plan (Rec. E.164/E.163)
                      -- If it's a normal message :
                      Length = 13 semi-octet(s)
                      Num = 8613817803555
             TP-PID=00h: No interworking, but SME-to-SME protocol
             TP-DCS=C0h: Discard Message:
                    Set Indication Inactive / Voicemail Message Waiting
             TP-SCTS:
                    November 28th 06
                    15h 16m 44s        Time Zone: GMT + 8h0m (23h=32)
             TP-UDL = 1 (01h)
             TP-UD (SMS Message):   ("Default 7 bit Alphabet")
             Texte : @

7.        USSD
首先它是一个增值业务,用户发送特定的指令给网络,网络返回相应的信息。(在通话状态下,USSD和SMS使用相同的信令信道即独立专用控制信道(SDCCH),数据传输速率大约为600bit/s。而在非通话状态下,SMS使用慢速伴随信道(SACCH),而USSD使用快速伴随信道(FACCH),数据传输速率大约为1kbit/s,比SMS传输速率要快; 当然这些是理论,不是绝对的,需要看当地网络的实际信道配置使用)
MOD_RMC->MOD_LAPDM | RMC_LAPDM_SAP | FN: 1760088 | T=41881 | MSG_ID_RR_LAPDM_DATA_REQ | MS => BS
Channel_Type=SDCCH
>l3ss tif=0 ti=1 N(SD)=0   REGISTER   :
            "Facility" IE:
               "Facility IEI"
            "Operation Code:ProcessUSSReq"
            USSD PHASE 2 DE REQUEST :(codage 7 bits->8 bits):
               '*100*+69#'
               "Supl. Service phase 2"
            SS Version Indicator = 00h: Supplementary Service Phase 2
MOD_L1->MOD_AS | L1_AS_SAP | FN: 1760341 | T=42134 | MSG_ID_LAPDM_RR_DATA_IND | BS => MS
Channel_Type=SDCCH
>l3ss tif=1 ti=1 N(SD)=0   RELEASE_COMPLETE   :
            "Facility" IE:
               "Facility IEI"
               "Error:Unrecognized Operation" //如果之前发送有效的指令,这里显示具体的返回内容

8.        CBS
广播消息,它与普通短消息的区别在于,广播消息是单向的,只能由网络发送给手机终端用户。并且需要在手机中设置好对应的广播频道信息,另外还需要手机要处于Idle 状态才有可能收到(因为网络一般是间断的向一定的区域发送广播消息)。


wright_wu 发表于 2010-11-17 14:42:08

下面我们就来看看一条普通短消息的发送流程:

       在手机上编辑一条短消息,选择发送对象后,进行发送,之后手机就和移动网络进行交互了:

1). 手机先和接入网(主要包括 BSC, BS)交互,申请建立专用信道,用于之后的鉴权、加密、数据传输…

2). 由BSC要求BS分配无线资源, BS分配好后给BSC回应.

3).BSC回应手机的接入请求,将分配好的专用信道资源信息给手机使用.

4). 手机从公共信道跳转到分配到的专用信道资源上,发送CLASSMARK CHANGE给网络,告知网络手机本身支持的一些功能(比如: 加密算法,功率等级,频段…)

5). 核心网(主要包括 MSC, VLR, HLR)对手机进行鉴权,手机端和网络端分别计算SRES值,然后手机将结果发送到网络比较.

6). 核心网要求手机使用加密,手机回应网络使用相应的加密算法.

7). 鉴权和加密之后,手机可以将编辑的短消息以CP_DATA方式发送给MSC, 具体内容可以参考http://oa.headware.cn:8888/general/bbs2/viewthread.php?tid=43623&extra=page%3D4.

8). MSC向VLR查询发送方是否可以发送消息.(因为SIM卡开户的时候,会开通一些服务,比如Voice Call, SMS, CF,CW…, 这些信息永久的保存在其归属HLR里面,随着终端的移动,当前的VLR会向归属HLR里面取这些数据; 如果没有开通的话,到此网络就会给手机回应不能发送的原因,发送流程到此结束)

9). VLR在确认MS具有短消息业务且没有被禁止后,通知MSC当前MS可以发送短消息

10). MSC向IWMSC转发短消息

11). IWMSC向SC(短消息中心)转发短消息

12). SC通知IWMSC已接收短消息, IWMSC通知MSC已接收短消息, MSC通知MS短消息发送成功.

13). 网络端释放专用信道资源后,手机重新回到公共信道,至此发送流程结束. 至于接收方是否能及时收到此短消息,要看接收方的方方面面,当前是否开机、是否有网络覆盖、短消息是否已满….

shyboy2 发表于 2011-6-6 15:21:05

:dizzy:

流浪咖啡 发表于 2011-7-17 11:46:34

谢谢楼主分享
页: [1]
查看完整版本: 谈谈短消息的种类