根据gbt28181协议,注册到SPVMN平台的方法

说明:SPVMN平台IP为192.168.8.180,设备IP为192.168.8.184


一、向平台注册的交互协议

1、客户机向SPVMN平台注册协议

REGISTER sip:34020000002000000001@3402000000 SIP/2.0
Via: SIP/2.0/UDP 192.168.8.184:5060;rport;branch=z9hG4bK1839159132
From: <sip:34020000001320000001@3402000000>;tag=1168363890
To: <sip:34020000001320000001@3402000000>
Call-ID: 434018964
CSeq: 1 REGISTER
Contact: <sip:[email protected]:5060>
Max-Forwards: 70
User-Agent: IP Camera
Expires: 3600
Content-Length: 0

2、平台回复包

SIP/2.0 401 Unauthorized
CSeq: 1 REGISTER
Call-ID: 434018964
From: <sip:34020000001320000001@3402000000>;tag=1168363890
To: <sip:34020000001320000001@3402000000>;tag=90691234_53173353_a67d0e0e-e55c-4ac7-9d5a-f78e149aaf81
Via: SIP/2.0/UDP 192.168.8.184:5060;rport=5060;branch=z9hG4bK1839159132;received=192.168.8.184
WWW-Authenticate: Digest realm="3402000000",nonce="b1f444e6805f2768"
Content-Length: 0

3、验证注册

REGISTER sip:34020000002000000001@3402000000 SIP/2.0
Via: SIP/2.0/UDP 192.168.8.184:5060;rport;branch=z9hG4bK119722870
From: <sip:34020000001320000001@3402000000>;tag=1168363890
To: <sip:34020000001320000001@3402000000>
Call-ID: 434018964
CSeq: 2 REGISTER
Contact: <sip:[email protected]:5060>
Authorization: Digest username="34020000001320000001", realm="3402000000", nonce="b1f444e6805f2768", uri="sip:34020000002000000001@3402000000", response="97cae60143bf336443d0bc5e669571a9", algorithm=MD5
Max-Forwards: 70
User-Agent: IP Camera
Expires: 3600
Content-Length: 0

4、平台回复

SIP/2.0 200 OK
CSeq: 2 REGISTER
Call-ID: 434018964
From: <sip:34020000001320000001@3402000000>;tag=1168363890
To: <sip:34020000001320000001@3402000000>;tag=02949493_53173353_db24af08-e421-4de3-85e7-b3f3f5284b02
Via: SIP/2.0/UDP 192.168.8.184:5060;rport=5060;branch=z9hG4bK119722870;received=192.168.8.184
Contact: <sip:[email protected]:5060>
Expires: 3600
Date: 2015-11-05T10:55:56.012
Content-Length: 0

5、客户端向平台的消息请求包

MESSAGE sip:34020000002000000001@3402000000 SIP/2.0
Via: SIP/2.0/UDP 192.168.8.184:5060;rport;branch=z9hG4bK10460200
From: <sip:34020000001320000001@3402000000>;tag=1056449357
To: <sip:34020000002000000001@3402000000>
Call-ID: 897764098
CSeq: 20 MESSAGE
Content-Type: Application/MANSCDP+xml
Max-Forwards: 70
User-Agent: IP Camera
Content-Length:   162

<?xml version="1.0" encoding="UTF-8"?>
<Notify>
<CmdType>Keepalive</CmdType>
<SN>105</SN>
<DeviceID>34020000001320000001</DeviceID>
<Status>OK</Status>
</Notify>

6、平台回复

D?IWEge<@SSIP/2.0 200 OK
CSeq: 20 MESSAGE
Call-ID: 897764098
From: <sip:34020000001320000001@3402000000>;tag=1056449357
To: <sip:34020000002000000001@3402000000>;tag=32617088_53173353_9281af7a-b890-44e0-8033-2f61d4af7c64
Via: SIP/2.0/UDP 192.168.8.184:5060;rport=5060;branch=z9hG4bK10460200;received=192.168.8.184
Content-Length: 0

到此,注册成功。


二、视频播放协议

2.1 平台向设备请求数据

INVITE sip:34020000001320000001@3402000000 SIP/2.0
Call-ID: [email protected]
CSeq: 1 INVITE
From: <sip:34020000002000000001@3402000000>;tag=41363971_53173353_e9868597-2a56-4171-911d-d527eb58c307
To: <sip:34020000001320000001@3402000000>
Max-Forwards: 70
Contact: "34020000002000000001" <sip:<span style="font-family: Arial, Helvetica, sans-serif;">192.168.8.180</span><span style="font-family: Arial, Helvetica, sans-serif;">:5060></span>
Content-Type: application/sdp
Route: <sip:[email protected]:5060;lr>
Via: SIP/2.0/UDP 192.168.8.180:5060;branch=z9hG4bKe9868597-2a56-4171-911d-d527eb58c307_53173353_50921343723068
Content-Length: 225

v=0
o=34020000002020000001 0 0 IN IP4 192.168.8.180
s=Play
c=IN IP4 192.168.8.180
t=0 0
m=video 6000 RTP/AVP 96 98 97
a=recvonly
a=rtpmap:96 PS/90000
a=rtpmap:98 H264/90000
a=rtpmap:97 MPEG4/90000
y=0100000001
f=

2.2 设备回复平台的包

SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.8.180:5060;branch=z9hG4bKe9868597-2a56-4171-911d-d527eb58c307_53173353_50921343723068;received=192.168.8.180
From: <sip:34020000002000000001@3402000000>;tag=41363971_53173353_e9868597-2a56-4171-911d-d527eb58c307
To: <sip:34020000001320000001@3402000000>
Call-ID: [email protected]
CSeq: 1 INVITE
User-Agent: IP Camera
Content-Length: 0

SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.8.180:5060;branch=z9hG4bKe9868597-2a56-4171-911d-d527eb58c307_53173353_50921343723068;received=192.168.8.180
From: <sip:34020000002000000001@3402000000>;tag=41363971_53173353_e9868597-2a56-4171-911d-d527eb58c307
To: <sip:34020000001320000001@3402000000>;tag=833711816
Call-ID: [email protected]
CSeq: 1 INVITE
Contact: <sip:[email protected]:5060>
Content-Type: application/sdp
User-Agent: IP Camera
Content-Length:   227

v=0
o=34020000001320000001 3238 3238 IN IP4 192.168.8.184
s=play
c=IN IP4 192.168.8.184
t=0 0
m=video 15060 RTP/AVP 96
a=sendonly
a=rtpmap:96 PS/90000
a=username:34020000001320000001
a=password:12345678
y=0100000001

2.3 平台发给设备的ACK,设备收到这个包后,就可以向平台发送RTP数据了

ACK sip:[email protected]:5060 SIP/2.0
Call-ID: [email protected]
CSeq: 1 ACK
From: <sip:34020000002000000001@3402000000>;tag=41363971_53173353_e9868597-2a56-4171-911d-d527eb58c307
To: <sip:34020000001320000001@3402000000>;tag=833711816
Max-Forwards: 70
Via: SIP/2.0/UDP 192.168.8.180:5060;branch=z9hG4bKe9868597-2a56-4171-911d-d527eb58c307_53173353_50921370541873
Content-Length: 0




你可能感兴趣的:(根据gbt28181协议,注册到SPVMN平台的方法)