短信DCS理解 - 图文

更新时间:2023-12-23 02:08:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

1. 特殊消息-DCS字段承载

1.1. 字段来源

1、TP-DCS字段在etsi 0338协议或3gpp 23038协议里规定,也就是我们平时常说的0338协议,打开此协议你可以看到此字段虽然是一字节,但规定的值很多,含义丰富。 2、SMPP协议里的DCS字段参照etsi 0338协议里的定义。

1.2. 如何理解

打开etsi 0338协议,我们可以看到其DCS分多种情况进行定义,bit7~bit4为一段,bit3~bit0为一段。我们平时常用的dcs=0/4/8其实仅仅是其中的bit3与bit2的取值。重要的导读语在下面是蓝色字体标出:

SMS Data Coding Scheme

The TP-Data-Coding-Scheme field, defined in GSM 03.40, indicates the data coding scheme of the TP-UD field, and may indicate a message class. Any reserved codings shall be assumed to be the GSM default alphabet (the same as codepoint 00000000) by a receiving entity. The octet is used according to a coding group which is indicated in bits 7..4. The octet is then coded as follows:

Coding Group Bits 7..4 00xx Use of bits 3..0 General Data Coding indication Bits 5..0 indicate the following : Bit 5, if set to 0, indicates the text is uncompressed Bit 5, if set to 1, indicates the text is compressed using the GSM standard compression algorithm. ( see GSM TS 03.42) Bit 4, if set to 0, indicates that bits 1 to 0 are reserved and have no message class meaning Bit 4, if set to 1, indicates that bits 1 to 0 have a message class meaning : Bit 1 Bit 0 Message Class 0 0 1 1 0 1 0 1 Class 0 Class 1 Default meaning: ME-specific. Class 2 SIM specific message Class 3 Default meaning: TE specific (see GSM TS 07.05 [8]) 解读: 当bit7bit6=00时: 1、如果bit5=0表示内容是非压缩方式,如果bit5=1表示内容是压缩方式,压缩方法可参见GSM TS 03.42协议。 2、如果bit4=0表示bit1bit0无其它含义,如果bit4=1表示bit1bit0有意义,其bit1bit0的几种取值也是一些比较特殊的消息,其含义在后面的详细的解释,请先在这里作一标记,后面再解惑不同的Class究竟是什么意思。 Bits 3 and 2 indicate the alphabet being used, as follows : Bit 3 Bit2 Alphabet: 0 0 1 1 0 1 0 1 Default alphabet 8 bit data UCS2 (16bit) [10] Reserved 解读: Bits 3 and 2,我们测试过程中最常见的dcs=0/4/8。所以看到这里要摆脱新员工学习时的误区,不要认为ucs2编码时dcs只等于8,因为dcs字段是按比特来算的,同样dcs=24时bit3bit2也为10,也是ucs2编码,等等。 NOTE: The special case of bits 7..0 being 0000 0000 indicates the Default Alphabet as in Phase 2 0100..1011 1100 Reserved coding groups Message Waiting Indication Group: Discard Message Bits 3..0 are coded exactly the same as Group 1101, however with bits 7..4 set to 1100 the mobile may discard the contents of the message, and only present the indication to the user. 解读: 当bit7~bit4=1100时,其bit3~bit0的意义与下面bit7~bit4=1101一样,但不同的是当bit7~bit4=1100时,手机用户收以消息后仅做提示,看完后不会自动保存到收件箱里。 (continued) (concluded)

1101 Message Waiting Indication Group: Store Message This Group allows an indication to be provided to the user about the status of types of message waiting on systems connected to the GSM PLMN. The mobile may present this indication as an icon on the screen, or other MMI indication. The mobile may take note of the Origination Address for messages in this group and group 1100. For each indication supported, the mobile may provide storage for the Origination Address which is to control the mobile indicator. Text included in the user data is coded in the Default Alphabet. Where a message is received with bits 7..4 set to 1101, the mobile shall store the text of the SMS message in addition to setting the indication. Bits 3 indicates Indication Sense: Bit 3 0 1 Set Indication Inactive Set Indication Active Bit 2 is reserved, and set to 0 Bit 1 Bit 0 Indication Type: 0 0 1 1 0 1 0 1 Voicemail Message Waiting Fax Message Waiting Electronic Mail Message Waiting Other Message Waiting* * Mobile manufacturers may implement the “Other Message Waiting” indication as an additional indication without specifying the meaning. The meaning of this indication is intended to be standardized in the future, so Operators should not make use of this indication until the standard for this indication is finalized. 解读: 上面几bit的定义是指示手机有特殊消息存储在某处,手机用户看到后可以根据提示去收取,如语音消息、传真消息、电子邮件消息或其它消息。 如果有熟悉SMPP协议各TLV的意思的看官看到这里应该就会觉得很熟悉了,上面所说的Voicemail Message Waiting、Fax Message Waiting等与SMPP协议里ms_msg_wait_facilities字段的意义不是一样的嘛,对头,SMPP消息里若发送含ms_msg_wait_facilities与unmber_of_message的消息,从GSM网络下发,我们的短消息中心就会将SMPP TLV与上面的dcs作为映射,以提示手机正确显示。其对应转换关系请参见《GSM短信中心SMPP3.4 TLV字段解析》。 1110 Message Waiting Indication Group: Store Message The coding of bits 3..0 and functionality of this feature are the same as for the Message Waiting Indication Group above, (bits 7..4 set to 1101) with the exception that the text included in the user data is coded in the uncompressed UCS2 alphabet. 解读: 当bit7~bit4=1110时,bit3~bit0与上面一样的定义,但要注意的是bit7~bit4=1110时,消息内容是采用ucs2编码。 1111 Data coding/message class

Bit 3 is reserved, set to 0. Bit 2 Message coding: 0 1 0 0 1 1 0 1 0 1 Default alphabet 8-bit data Class 0 Class 1 default meaning: ME-specific. Class 2 SIM-specific message. Class 3 default meaning: TE specific (see GSM TS 07.05 [8]) Bit 1 Bit 0 Message Class: Default alphabet indicates that the TP-UD is coded from the 7-bit alphabet given in subclause 6.2.1. When this alphabet is used, the characters of the message are packed in octets as shown in subclause 6.1.2.1.1, and the message can consist of up to 160 characters. The default alphabet shall be supported by all MSs and SCs offering the service.

8-bit data indicates that the TP-UD has user-defined coding, and the message can consist of up to 140 octets.

UCS2 alphabet indicates that the TP-UD has a UCS2 [10] coded message, and the message can consist of up to 140 octets, i.e. up to 70 UCS2 characters. The General notes specified in subclause 6.1.1 override any contrary specification in UCS2, so for example even in UCS2 a character will cause the MS to return to the beginning of the current line and overwrite any existing text with the characters which follow the .

When a message is compressed, the TP-UD consists of the default alphabet or UCS2 alphabet compressed message, and the compressed message itself can consist of up to 140 octets in total. When a mobile terminated message is class 0 and the MS has the capability of displaying short messages, the MS shall display the message immediately and send an acknowledgement to the SC when the message has successfully reached the MS irrespective of whether there is memory available in the SIM or ME. The message shall not be automatically stored in the SIM or ME.

The ME may make provision through MMI for the user to selectively prevent the message from being displayed immediately.

If the ME is incapable of displaying short messages or if the immediate display of the message has been disabled through MMI then the ME shall treat the short message as though there was no message class, i.e. it will ignore bits 0 and 1 in the TP-DCS and normal rules for memory capacity exceeded shall apply.

When a mobile terminated message is Class 1, the MS shall send an acknowledgement to the SC when the message has successfully reached the MS and can be stored. The MS shall normally store the message in the ME by default, if that is possible, but otherwise the message may be stored elsewhere, e.g. in the SIM. The user may be able to override the default meaning and select their own routing.

When a mobile terminated message is Class 2 (SIM-specific), a phase 2 (or later) MS shall

ensure that the message has been transferred to the SMS data field in the SIM before sending an acknowledgement to the SC. The MS shall return a \error, unspecified\error message (see GSM TS 04.11) if the short message cannot be stored in the SIM and there is other short message storage available at the MS. If all the short message storage at the MS is already in use, the MS shall return \

When a mobile terminated message is Class 3, the MS shall send an acknowledgement to the SC when the message has successfully reached the MS and can be stored, irrespectively of whether the MS supports an SMS interface to a TE, and without waiting for the message to be transferred to the TE. Thus the acknowledgement to the SC of a TE-specific message does not imply that the message has reached the TE. Class 3 messages shall normally be transferred to the TE when the TE requests \to override the default meaning and select their own routing. 解读:

上面一大串说的就是Class0~Class3,每种类别的消息在手机收到后应做怎么样的处理,这些值对短消息中心来说没有特别的,但在外面对接或搞其它产品,这些值在各业务里有很多的应用。简单列一下上面的意思:

1、Class0消息,手机收到后不管手机或SIM卡里有没有空闲内存,这些消息都立即显示,显示之后这些消息不会自动存储到手机或SIM卡里,需要提醒用户是否保存。OK,这是什么消息呢,执行过基线的基线的用例的同学应该知道,这些就是所谓的闪电消息(目前很多海外用户需求里提及的Flash Message)。 2、Class1消息,手机收到后如果手机或SIM卡上只要有存储空间就应给短消息中心回应答,这些消息会自动存储到手机或SIM卡里,存储位置的优先级由用户在手机上设置。

3、Class2消息(SIM-specific),,手机收到后如果SIM卡有空闲空间则会自动存储到SIM卡里,注意这里不会存储到手机上去,如果SIM卡满了就返回\错误。 4、Class3消息,(TE-specific),手机收到后会将消息存储到另外一个存储设备上去,并立即给短消息中心回应答,也就是异步模式,短消息中心收到的应答消息里并不能够知道消息是否由手机中转至了另外的存储设备。

The message class codes may also be used for mobile originated messages, to provide an indication to the destination SME of how the message was handled at the MS.

The MS will not interpret reserved or unsupported values but shall store them as received. The SC may reject messages with a Data Coding Scheme containing a reserved value or one which is not supported.

总结一下:

在0338协议里DCS的值定义了多种,不同的取值在手机用户收到后都会有不同的显示。在短消息中心测试过程中,我们平时不太关心这些特殊的DCS值,发送最多的就是dcs=0/4/8,但其它的取值,特别是Class0~Class3的意义,站在运营商的角度来看他们就是一个特性,我看过一些海外的客户对短消息中心的基本需求,说HW短信中心是否支持Flash Message,是否支持Class1的消息?所以平时我们需要他们所说的这些术语是从哪里来的,特别是在外出差与其它厂商的设备进行对接时,什么样的消息我有没有发给你,你收到后是怎么处理的,找到正确的协议、正确的位置就是依据。

TP-DCS表示的常用特殊消息包括平时常用的7bit、8bit、ucs2编码的消息,闪电消息,不同Class类型的消息,特殊消息等待等等,自己记录一下与前面进行比对。

本文来源:https://www.bwwdw.com/article/q2g5.html

Top