在IMS和SIP中有一种交互信息,这就是CPIM(Common Presence and Instant Messaging),消息格式由 RFC3862 定义;我个人理解:此类消息类似于电脑游戏中参与对象之间的实时会话;
1.CPIM特点
消息可实现端到端保护格式(基于计算机签名规范);
独立于任何特定的应用协议;
能够传送一系列不同的地址类型;
基于一个8位(干净的)信息传输协议;
可进化, 可由多方扩展;
信息元数据与信息内容清楚地分开;
使用简单,规则和易于解析的语法;
消息简洁、格式低开销;
2.CPIM结构
CPIM消息由两部分构成:
第一部分:消息元数据Header;
第二部分:消息内容;
这两部分内容与按照其Content-type定义的MIME类型封装,且相互独立;相互之间用空格行隔开。
3.CPIM示例
MESSAGE sip:+[email]14448880011@sharetechnote.com[/email];user=phone SIP/2.0
P-Preferred-Service: urn:urn-7:3gpp-service.ims.icsi.oma.cpm.msg
Contribution-ID: 477b66ae9662e3ad18549bf5dabf9d26d5e707ca
Conversation-ID: 1710887c7ca47dc2c1274c11673eb0df5a604fd3
P-Preferred-Identity: <sip:310410123456789@sharetechnote.com>
Request-Disposition: no-fork
User-Agent: TEST IMS 5.0
CSeq: 1 MESSAGE
Max-Forwards: 70
P-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=31041000010000000
Route: <sip:[2001:0:0:1::2]:5060;lr>
a: *;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.msg"
c: message/cpim
f: <sip:310410123456789@sharetechnote.com>;tag=1384874566
i: 3712948749@2001::1:88fe:fccf:2870:5dee
l: 322
m: <sip:310410123456789@[2001::1:88fe:fccf:2870:5dee]:5060>;
+sip.instance="<urn:gsma:imei:35469106-056673-0>"
t: <sip:+[email]14448880011@sharetechnote.com[/email];user=phone>
v: SIP/2.0/TCP [2001::1:88fe:fccf:2870:5dee]:5060;branch=z9hG4bK2629405539smg;transport=TCP
From: <sip:310410123456789@sharetechnote.com> // CPIM Message Header
To: <sip:+[email]14448880011@sharetechnote.com[/email];user=phone> // CPIM Message Header
DateTime: 2015-02-17T06:54:27Z // CPIM Message Header
NS: imdn <urn:ietf:params:imdn> // CPIM Name Spage
imdn.Message-ID: PH7qAIV8cgH5
imdn.Disposition-Notification: positive-delivery, display
Content-type: text/plain;charset=UTF-8 // CPIM MIME Header
Content-Length: 15
123456789abcdef // Message Content
4.数据Header中字段说明
Header | 解释 | 示例 |
---|
From | 消息的发送者或发起者 Indicates the sender or originator of a message. | From: MR SANDERS im:piglet@100akerwood.com |
To | 消息的接收者 Specifies an intended recipient of a message. | To: Depressed Donkey im:eeyore@100akerwood.com |
cc | 可以理解成抄送的目标接收者 Indicates a courtesy copy recipient of a message. | cc: Winnie the Pooh im:pooh@100akerwood.com |
DateTime | 消息的发送时间Specifies the date and time a message was sent. | DateTime: 2000-12-13T13:40:00-08:00 |
Subject | 消息主题 和 语种描述 | Subject:;lang=en Eeyore’s feeling very depressed today |
NS | 命名空间前缀 Declare a local namespace prefix. | NS: MyAlias mid:MessageFeatures@id.foo.com |
Require | Specify a header or feature that must be implemented by the receiver for correct message processing. | Require: MyFeatures.VitalMessageOption MyFeatures.VitalMessageOption: Confirmation-requested |
原文来自:http://www.sharetechnote.com/和[url]https://blog.csdn.net/xiaxl/article/details/104718006/[/url]
整理:kangguoying20201005
"5G NSA网络接入问题排查要点”已在微信公众号"跟着老康学5G"中推出,敬请关注!