IMS/SIP学习(4)——subscribe、notify、invite过程
文章目录
SUBSCRIBE/NOTIFY
SUSCRIBE消息类似于无线电协议上的“测量控制”或“信息请求”。 它要求另一方报告任何特定事件或特定状态。
NOTIFY类似于无线电协议上的“测量报告”或“信息响应”。 基本上,它传递SUBSCRIBE消息请求的信息。 (有关SUBSCRIBE / NOTIFY过程的正式说明,请参阅RFC3265会话初始协议(SIP)特定事件通知)。
SUBSCRIBE和NOTIFY的总体顺序如下。
SUBSCRIBE支持哪些事件?
当然,SUBSCRIBE中最常用的事件是“ reg”(用于注册状态检查),但是可能还有其他事件可用。 有关这些事件的正式信息,可以在会话启动协议(SIP)事件类型命名空间中找到。 以下是我经常在我的领域中看到的事件列表(IMS中正在使用SIP)。
通知消息中的订阅状态:
当NOTIFIER(通常为CSCF)并且没有错误的情况(例如481、400、500)时,除了在主体上的详细订阅信息外,通知者还发送具有特定Subscription-State信息的NOTIFY消息。
Step 1 : SUBSCRIBE
SUBSCRIBE sip:aaa@qq.com SIP/2.0
Via: SIP/2.0/UDP 10.133.202.46:50997;branch=z9hG4bK2968d27245f17c7bcae38c31991bfdaa
Max-Forwards: 70
Contact: <sip:aaa@qq.com:50997>;+sip.instance="<urn:gsma:imei:00440113-904785-0>"
To: <sip:aaa@qq.com>
From: <sip:aaa@qq.com>;tag=210a54
Call-ID: aaa@qq.com
CSeq: 14534 SUBSCRIBE
Expires: 600000
User-Agent: IM-client/OMA1.0 DUT-IMS
Event: reg
Accept: application/reginfo+xml
P-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp="0010100010000000"
P-Preferred-Identity: <sip:aaa@qq.com>
Content-Length: 0
Step 2 : 200 OK
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.133.202.46:50997;branch=z9hG4bK2968d27245f17c7bcae38c31991bfdaa
From: <sip:aaa@qq.com>;tag=210a54
To: <sip:aaa@qq.com>;tag=987654321
Call-ID: aaa@qq.com
CSeq: 14534 SUBSCRIBE
Expires: 600000
Contact: <sip:10.133.202.47:5060>
Record-Route: <sip:10.133.202.47;lr>
Content-Length: 0
Step 3 : NOTIFY
NOTIFY sip:aaa@qq.com SIP/2.0
Via: SIP/2.0/UDP 10.133.202.47:5060;branch=z9hG4bK-d1e4c4961ca9d523ae76b67e088589cd
Call-ID: aaa@qq.com
From: <sip:aaa@qq.com>;tag=987654321
To: <sip:aaa@qq.com>;tag=210a54
Subscription-State: active;expires=600000
Event: reg
CSeq: 14534 NOTIFY
Contact: <sip:10.133.202.47:5060>
Max-Forwards: 70
Content-Type: application/reginfo+xml
Content-Length: 340
<?xml version="1.0" encoding="UTF-8"?>
<reginfo xmlns="urn:ietf:params:xml:ns:reginfo" version="0" state="full">
<registration aor="sip:aaa@qq.com" id="12345" state="active">
<contact id="100" state="active" event="registered" expires="600000">
<uri>sip:aaa@qq.com:50997</uri>
</contact>
</registration>
</reginfo>
Step 4 : 200 OK
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.133.202.47:5060;branch=z9hG4bK-d1e4c4961ca9d523ae76b67e088589cd
Max-Forwards: 70
Contact: <sip:aaa@qq.com:50997>;+sip.instance="<urn:gsma:imei:00440113-904785-0>"
To: <sip:aaa@qq.com>;tag=210a54
From: <sip:aaa@qq.com>;tag=987654321
Call-ID: aaa@qq.com
CSeq: 14534 NOTIFY
Allow: NOTIFY,SUBSCRIBE
Content-Length: 0
INVITE – VoLTE
INVITE是基于SIP的通信中的会话发起(会话创建)过程。存在一些不需要会话建立的SIP通信(例如,IMS上的SMS或某种其他形式的短消息),但是大多数基于IMS / SIP的通信(例如,VoLTE,视频,文件传输等)正在进行在一个会话中。每当需要建立会话时,都由INVITE进程完成。此过程的关键部分是在开始时是“邀请”,在结尾处是200 OK。但是实际上,在INVITE和200OK之间正在进行许多其他步骤,并且INVITE和200 OK之间的消息的详细顺序取决于要建立的会话类型。(如果您不熟悉会话的含义,请参阅“会话”页面)
此页面中的示例是VoLTE中使用的最简单的INVITE形式。此页面中的示例仅关注INVITE及其对应的200 OK。如果您想了解其他消息的详细信息以及这些消息的内容,请参阅带有前提条件的MO VoLTE。
(1) INVITE
INVITE sip:aaa@qq.com:35057 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.12:64701;branch=z9hG4bK635101086453090273;rport;transport=UDP
Max-Forwards: 69
Call-ID: aaa@qq.com
CSeq: 7 INVITE
Via: SIP/2.0/UDP 192.168.1.2:64627;branch=z9hG4bK635101086453000268;transport=UDP
To: <sip:aaa@qq.com>
From: <sip:aaa@qq.com>;tag=1111111111
Contact: <sip:aaa@qq.com:64627;transport=udp>
Allow: INVITE, UPDATE, ACK, CANCEL, BYE, PRACK, MESSAGE
Supported: 100rel
Supported: precondition
Accept-Contact: *;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-application.ims.iari.gsma-vs";require;explicit
Privacy: id
Content-Type: application/sdp
Content-Length: 565
Record-Route: <sip:192.168.1.2;lr>
200 OK
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.12:64701;rport=64701;branch=z9hG4bK635101086453090273;transport=UDP
From: <sip:aaa@qq.com>;tag=1111111111
To: <sip:aaa@qq.com>;tag=1076437947
Contact: <sip:aaa@qq.com:35057;transport=udp>
Call-ID: aaa@qq.com
CSeq: 7 INVITE
Content-Type: application/sdp
Content-Length: 527
Via: SIP/2.0/UDP 192.168.1.2:64627;branch=z9hG4bK635101086453000268;transport=UDP
Record-Route: <sip:192.168.1.2;lr>
Allow: ACK, BYE, CANCEL, INVITE, MESSAGE, NOTIFY, OPTIONS, PRACK, REFER, UPDATE
ACK
ACK sip:aaa@qq.com:35057 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.12:64703;branch=z9hG4bK635101086492402521;rport;transport=UDP
Max-Forwards: 69
Call-ID: aaa@qq.com
CSeq: 7 ACK
To: <sip:aaa@qq.com>;tag=1076437947
From: <sip:aaa@qq.com>;tag=1111111111
Via: SIP/2.0/UDP 192.168.1.2:64627;branch=z9hG4bK635101086453000268;transport=UDP
Content-Length: 0
下期预告
下次介绍一下IMS SIP里的一些标识和卡文件吧
上一篇: 软件工程复习要点