GB28181平台对接接口详解

Posted 老樊Lu码

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GB28181平台对接接口详解相关的知识,希望对你有一定的参考价值。

28181平台对接接口详解

信令接口:

1.1 平台注册

  • 下级平台主动向上级平台注册;
  •  注册鉴权信息(用户名和密码)由上级提供;

举例说明:

下级--->上级
REGISTER sip:62010000002000000001@10.130.140.82:7100 SIP/2.0
Call-ID: c82dee890ea56d9d332fe4a5dbd2772c@10.129.4.21 CSeq: 1 REGISTER
From: <sip:62010201002000000001@10.129.4.21:5080>;tag=5923_661_2647061 To: <sip:62010201002000000001@10.129.4.21:5080>
Max-Forwards: 70
Contact: <sip:62010201002000000001@10.129.4.21:5080>
Expires: 3600
Via: SIP/2.0/UDP 10.129.4.21:5080;branch=z9hG4bK2647061_661_55795848069639126081
Content-Length: 0
 
上级--->下级
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.129.4.21:5080;branch=z9hG4bK2647061_661_55795848069639126081 From: <sip:62010201002000000001@10.129.4.21:5080>;tag=5923_661_2647061
To: <sip:62010201002000000001@10.129.4.21:5080>;tag=316765889
Call-ID: c82dee890ea56d9d332fe4a5dbd2772c@10.129.4.21 CSeq: 1 REGISTER
WWW-Authenticate: Digest realm="1234", nonce="7104983f5477dd30a65167b28553df65", opaque="f10efb1af3e8a362bcda7465284073ce", algorithm=MD5
User-Agent: Hikvision Expires: 3600

REGISTER sip:62010000002000000001@10.130.140.82:7100 SIP/2.0
Call-ID: c82dee890ea56d9d332fe4a5dbd2772c@10.129.4.21 CSeq: 2 REGISTER
From: <sip:62010201002000000001@10.129.4.21:5080>;tag=5923_661_2647061 To: <sip:62010201002000000001@10.129.4.21:5080>
Max-Forwards: 70
Contact: <sip:62010201002000000001@10.129.4.21:5080>
Via: SIP/2.0/UDP 10.129.4.21:5080;branch=z9hG4bK2647061_661_19459966820285136301
Authorization: Digest username="admin",realm="1234",nonce="7104983f5477dd30a65167b28553df65",uri="sip:6201000000200 0000001@10.130.140.82:7100",response="ceb3a346523335fb0c6d66d24a7e77b5",algorithm=MD5,opaqu e="f10efb1af3e8a362bcda7465284073ce"
Expires: 3600
Content-Length: 0
 
上级--->下级
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.129.4.21:5080;branch=z9hG4bK2647061_661_19459966820285136301 From: <sip:62010201002000000001@10.129.4.21:5080>;tag=5923_661_2647061
To: <sip:62010201002000000001@10.129.4.21:5080>;tag=300030239
Call-ID: c82dee890ea56d9d332fe4a5dbd2772c@10.129.4.21 CSeq: 2 REGISTER
Contact: <sip:62010201002000000001@10.129.4.21:5080>
User-Agent: Hikvision Date: 2013-07-27T14:45:39
Content-Length: 0

1.2 平台心跳保活
下级平台定期向上级平台发心跳消息;
 定期时间可配置,上下级配置一致;
上级平台连续三次未收到下级心跳消息,则认为下级平台离线;
 下级平台连续三次未收到心跳响应,则认为上级平台离线;
  举例说明:
下级--->上级
MESSAGE sip:62010000002000000001@10.130.140.82:7100 SIP/2.0 Call-ID: 69c20964c5c9a8f0cc6cc5a7381423d5@10.129.4.13
CSeq: 1 MESSAGE
From: <sip:62010201002000000001@10.129.4.13>;tag=0673_661_2850021 To: <sip:62010000002000000001@10.130.140.82>
 
Max-Forwards: 70
Content-Type: application/Xml
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK2850021_661_35032844903563514200
Content-Length: 138
<?xml version="1.0" ?>
<Notify>
<CmdType>Keepalive</CmdType>
<SN>43</SN>
<DeviceID>62010201002000000001</DeviceID>
<Status>OK</Status>
</Notify>
上级--->下级
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK2850021_661_35032844903563514200 From: <sip:62010201002000000001@10.129.4.13>;tag=0673_661_2850021
To: <sip:62010000002000000001@10.130.140.82>;tag=1421372822 Call-ID: 69c20964c5c9a8f0cc6cc5a7381423d5@10.129.4.13
CSeq: 1 MESSAGE
Content-Length: 0

1.3 平台设备共享
 下级平台将设备共享给上级平台,共享关系临时保存在本地数据库;
 下级平台收到上级平台的目录查询消息时,返回共享给该上级平台的所有共享设备信息;
 上级平台收到目录查询响应结果后,根据设备编码或自定义方式给设备建立目录;
 上级平台最好支持定期查询目录和手动查询目录功能,以便及时获取到下级平台新共享  的设备;
 举例说明:
上级--->下级
MESSAGE sip:62010201002000000001@10.129.4.13:5080 SIP/2.0 Via: SIP/2.0/UDP 172.16.3.26:7100;rport;branch=z9hG4bK3420267366
From: <sip:62010000002000000001@10.183.21.20:7100>;tag=500485300 To: <sip:62010201002000000001@10.129.4.13:5080>
Call-ID: 124958176
CSeq: 20 MESSAGE
Content-Type: Application/MANSCDP+xml Max-Forwards: 70
User-Agent: Hikvision
Content-Length: 127
<?xml version="1.0"?>
<Query>
<CmdType>Catalog</CmdType>
<SN>8903</SN>
<DeviceID>62010201002000000001</DeviceID>
</Query>
 
下级--->上级
SIP/2.0 200 OK
To: <sip:62010201002000000001@10.129.4.13:5080>;tag=6840_661_3935882
Via: SIP/2.0/UDP 172.16.3.26:7100;rport=7100;branch=z9hG4bK3420267366;received=10.130.140.82 CSeq: 20 MESSAGE
Call-ID: 124958176
From: <sip:62010000002000000001@10.183.21.20:7100>;tag=500485300
Content-Length: 0
 
下级--->上级
MESSAGE sip:62010000002000000001@10.130.140.82:7100 SIP/2.0
Call-ID: 3c2375ee902cdef0c10aa9fe2001e4f9@10.129.4.13 CSeq: 1 MESSAGE
From: <sip:62010201002000000001@10.129.4.13>;tag=7373_661_6058761 To: <sip:62010000002000000001@10.130.140.82>
Max-Forwards: 70
Content-Type: application/MANSCDP+XML
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK6058761_661_61989619576009343309
Content-Length: 746
 
 
<?xml version="1.0" encoding="UTF-8" ?>
<Response>
<CmdType>Catalog</CmdType>
<SN>8903</SN>
<DeviceID>62010201002000000001</DeviceID>
<SumNum>2</SumNum>
<DeviceList Num="1">
<Item>
<DeviceID>62010401001310004766</DeviceID>
<Name>共享镜头01</Name>
<Manufacturer>hik</Manufacturer>
<Owner>1</Owner>
<Model>1</Model>
<CivilCode>62010201002000000001</CivilCode>

 
<Address>1</Address>
<Parental>0</Parental>
<CertNum>1</CertNum>
<Certifiable>1</Certifiable>
<ErrCode>400</ErrCode>
<ParentID>62010201002000000001</ParentID>
<RegisterWay>1</RegisterWay>
<Secrecy>0</Secrecy>
<IPAddress></IPAddress>
<Port>0</Port>
<Longitude>0.000000</Longitude>
<Latitude>0.000000</Latitude>
<Status>ON</Status>
</Item>
</DeviceList>
</Response>
 
上级--->下级
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK6058761_661_61989619576009343309 From: <sip:62010201002000000001@10.129.4.13>;tag=7373_661_6058761
To: <sip:62010000002000000001@10.130.140.82>;tag=3437297396
Call-ID: 3c2375ee902cdef0c10aa9fe2001e4f9@10.129.4.13 CSeq: 1 MESSAGE
User-Agent: Hikvision
Content-Length: 0
 
下级--->上级
MESSAGE sip:62010000002000000001@10.130.140.82:7100 SIP/2.0
Call-ID: 7e4db4fa734be13c979511f6a8e84df6@10.129.4.13 CSeq: 1 MESSAGE
From: <sip:62010201002000000001@10.129.4.13>;tag=5183_661_6342350 To: <sip:62010000002000000001@10.130.140.82>
Max-Forwards: 70
Content-Type: application/MANSCDP+XML
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK6342350_661_77897377155966919994
Content-Length: 749
 
 
<?xml version="1.0" encoding="UTF-8" ?>
<Response>
<CmdType>Catalog</CmdType>
<SN>8903</SN>
<DeviceID>62010201002000000001</DeviceID>

 
<SumNum>2</SumNum>
<DeviceList Num="1">
<Item>
<DeviceID>62010501001310005076</DeviceID>
<Name>共享镜头02</Name>
<Manufacturer>hik</Manufacturer>
<Owner>1</Owner>
<Model>1</Model>
<CivilCode>62010201002000000001</CivilCode>
<Address>1</Address>
<Parental>0</Parental>
<CertNum>1</CertNum>
<Certifiable>1</Certifiable>
<ErrCode>400</ErrCode>
<ParentID>62010201002000000001</ParentID>
<RegisterWay>1</RegisterWay>
<Secrecy>0</Secrecy>
<IPAddress></IPAddress>
<Port>0</Port>
<Longitude>0.000000</Longitude>
<Latitude>0.000000</Latitude>
<Status>ON</Status>
</Item>
</DeviceList>
</Response>
  
备注:
上级--->下级
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK6342350_661_77897377155966919994 From: <sip:62010201002000000001@10.129.4.13>;tag=5183_661_6342350
To: <sip:62010000002000000001@10.130.140.82>;tag=3651745157
Call-ID: 7e4db4fa734be13c979511f6a8e84df6@10.129.4.13 CSeq: 1 MESSAGE
User-Agent: Hikvision Content-Length: 0

上级平台收到下级平台目录查询响应消息后,根据SumNum字段确定共享设备数量,并累计DeviceList的Item数量,当累计数量和SumNum字段值相等时,则说明查询结束。


1.4 共享设备状态变更通知
下级平台共享设备状态变更时通知给上级平台;
举例说明:
下级--->上级
NOTIFY sip:62010000002000000001@10.130.140.82:7100 SIP/2.0
Call-ID: cd0cba2fc6dc8baa82738ffdf4f13add@10.129.4.13 CSeq: 1 NOTIFY
From: <sip:62010201002000000001@10.129.4.13>;tag=7373_661_6058761 To: <sip:62010000002000000001@10.130.140.82>
Max-Forwards: 70
Content-Type: application/MANSCDP+XML
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK6058761_661_61989619576009343309
Content-Length: 747
 
 
<?xml version='1.0' encoding='UTF-8'?>
<Response>
<CmdType>Catalog</CmdType>
<SN>3</SN>
<DeviceID>62010201002000000001</DeviceID>
<SumNum>1</SumNum>
<DeviceList Num="1">
<Item>
<DeviceID>62010401001310004766</DeviceID>
<Name>共享镜头01</Name>
<Manufacturer>hik</Manufacturer>
<Model>1</Model>
<Owner>1</Owner>
<CivilCode>62010201002000000001</CivilCode>
<Address>1</Address>
<Parental>0</Parental>
<CertNum>1</CertNum>
<Certifiable>1</Certifiable>
<ErrCode>400</ErrCode>
<ParentID>62010201002000000001</ParentID>
<RegisterWay>1</RegisterWay>
<Secrecy>0</Secrecy>
<IPAddress></IPAddress>
<Port>0</Port>
<Longitude>0.000000</Longitude>
<Latitude>0.000000</Latitude>
<Status>OFF</Status>
</Item>
</DeviceList>
</Response>

 
上级--->下级
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK6058761_661_61989619576009343309 From: <sip:62010201002000000001@10.129.4.13>;tag=7373_661_6058761
To: <sip:62010000002000000001@10.130.140.82>;tag=3437297396
Call-ID: cd0cba2fc6dc8baa82738ffdf4f13add@10.129.4.13 CSeq: 1 NOTIFY
User-Agent: Hikvision
Content-Type: application/MANSCDP+XML Content-Length: 171
 
<?xml version="1.0" encoding="GB2312" ?>
<Response>
<CmdType>Catalog</CmdType>
<SN>3</SN>
<DeviceID>62010201002000000001</DeviceID>
<Result>OK</Result>
</Response>

1.5 实时视频
 上级平台请求下级共享镜头视频;
举例说明:
上级--->下级
INVITE sip:62010201001310000033@10.129.4.21:5080 SIP/2.0
Via: SIP/2.0/UDP 10.130.140.82:7100;rport;branch=z9hG4bK1642482264 From: <sip:62010000002000000001@10.130.140.82:7100>;tag=3983823828 To: <sip:62010201001310000033@10.129.4.21:5080>
Call-ID: 2081113375
CSeq: 20 INVITE
Contact: <sip:62010000002000000001@10.130.140.82:7100>
Content-Type: Application/SDP Max-Forwards: 70
User-Agent: Hikvision
Subject: 62010201001310000033:0,62010000002000000001:0
Content-Length: 220
 
v=0
o=62010201001310000033 0 0 IN IP4 10.130.140.82
s=Play
c=IN IP4 10.130.140.82
t=0 0
m=video 5400 RTP/AVP 96 97 98
a=rtpmap:96 PS/90000 a=rtpmap:97 MPEG4/90000 a=rtpmap:98 H264/90000 a=recvonly
y=0999999999
 
下级--->上级
SIP/2.0 100 Trying
To: <sip:62010201001310000033@10.129.4.21:5080> Via: SIP/2.0/UDP
10.130.140.82:7100;rport=7100;branch=z9hG4bK1642482264;received=10.130.140.82 CSeq: 20 INVITE
Call-ID: 2081113375
From: <sip:62010000002000000001@10.130.140.82:7100>;tag=3983823828
Content-Length: 0
 
下级--->上级
SIP/2.0 200 OK
To: <sip:62010201001310000033@10.129.4.21:5080>;tag=3222_661_8389915 Via: SIP/2.0/UDP
10.130.140.82:7100;rport=7100;branch=z9hG4bK1642482264;received=10.130.140.82 CSeq: 20 INVITE
Call-ID: 2081113375
From: <sip:62010000002000000001@10.130.140.82:7100>;tag=3983823828 Contact: <sip:10.129.4.21:5080>
Content-Type: application/sdp
Content-Length: 277
 
v=0
o=huawei 1375083193016081 0 IN IP4 10.129.4.21
s=Play
c=IN IP4 10.129.4.21
t=0 0
m=video 6016 RTP/AVP 96 a=rtpmap:96 PS/90000 a=sendonly
m=audio 6018 RTP/AVP 100 a=rtpmap:100 G711U a=sendonly a=username:admin a=password:123456
y=0999999999
f=v/2/1/0/1/0a///
 
上级--->下级
ACK sip:10.129.4.21:5080 SIP/2.0
Via: SIP/2.0/UDP 10.130.140.82:7100;rport;branch=z9hG4bK825701276 From: <sip:62010000002000000001@10.130.140.82:7100>;tag=3983823828 To: <sip:62010201001310000033@10.129.4.21:5080>;tag=3222_661_8389915 Call-ID: 2081113375
CSeq: 20 ACK
Contact: <sip:62010000002000000001@10.130.140.82:7100>
Max-Forwards: 70 
User-Agent: Hikvision 
Content-Length: 0
 
上级--->下级
BYE sip:10.129.4.21:5080 SIP/2.0
Via: SIP/2.0/UDP 10.130.140.82:7100;rport;branch=z9hG4bK825701276 From: <sip:62010000002000000001@10.130.140.82:7100>;tag=3983823828 To: <sip:62010201001310000043@10.129.4.21:5080>;tag=3222_661_8389915 Call-ID: 2081113375
CSeq: 21 BYE
Contact: <sip:62010000002000000001@10.130.140.82:7100>
Max-Forwards: 70 
User-Agent: Hikvision 
Content-Length: 0
1.6 云台控制
 上级平台向下级平台发送云台控制请求;
 举例说明:
上级--->下级
MESSAGE sip:62010201001310000033@10.129.4.21:5080 SIP/2.0
Via: SIP/2.0/UDP 10.130.140.82:7100;rport;branch=z9hG4bK2582872259
From: <sip:62010000002000000001@10.130.140.82:7100>;tag=3773325418
To: <sip:62010201001310000033@10.129.4.21:5080>
Call-ID: 1813198482
CSeq: 20 MESSAGE
Content-Type: Application/MANSCDP+xml
Max-Forwards: 70
User-Agent: Hikvision
Content-Length: 298
 
 
<?xml version="1.0"?>
<Control>
<CmdType>DeviceControl</CmdType>
<SN>8</SN>
<DeviceID>62010201001310000033</DeviceID>
<PTZCmd>a50f4d0000000001</PTZCmd>
<Info>
<ControlPriority>150</ControlPriority>
<startX>0</startX>
<startY>0</startY>
<endX>0</endX>
<endY>0</endY>
</Info>
</Control>
 
下级--->上级
SIP/2.0 200 OK
To: <sip:62010201001310000033@10.129.4.21:5080>;tag=5541_661_3619007 Via: SIP/2.0/UDP
10.130.140.82:7100;rport=7100;branch=z9hG4bK2582872259;received=10.130.140.82 CSeq: 20 MESSAGE
Call-ID: 1813198482
From: <sip:62010000002000000001@10.130.140.82:7100>;tag=3773325418
Content-Length: 0

1.7 录像查询
上级平台向下级平台查询录像请求;
 举例说明:
上级--->下级
MESSAGE sip:62010201002000000001@10.129.4.13:5080 SIP/2.0 Via: SIP/2.0/UDP 172.16.3.26:7100;rport;branch=z9hG4bK442669892
From: <sip:62010000002000000001@10.183.21.20:7100>;tag=2630907596 To: <sip:62010201002000000001@10.129.4.13:5080>
Call-ID: 3317287086
CSeq: 20 MESSAGE
Content-Type: Application/MANSCDP+xml Max-Forwards: 70
User-Agent: Hikvision 
Content-Length: 258
 
 
<?xml version="1.0"?>
<Query>
<CmdType>RecordInfo</CmdType>
<SN>1894</SN>
<DeviceID>62010201001310003793</DeviceID>
<StartTime>2013-11-07T00:00:00</StartTime>
<EndTime>2013-11-07T23:59:59</EndTime>
<Type>all</Type>
<RecordPos>1</RecordPos>
</Query>
 
下级--->上级
SIP/2.0 200 OK
To: <sip:62010201002000000001@10.129.4.13:5080>;tag=2792_661_3882029
Via: SIP/2.0/UDP 172.16.3.26:7100;rport=7100;branch=z9hG4bK442669892;received=10.130.140.82 CSeq: 20 MESSAGE
Call-ID: 3317287086
From: <sip:62010000002000000001@10.183.21.20:7100>;tag=2630907596
Content-Length: 0
 
下级--->上级
MESSAGE sip:62010000002000000001@10.130.140.82:7100 SIP/2.0
Call-ID: 8330948e40f07059c8cdccdc02d5aefd@10.129.4.13 CSeq: 1 MESSAGE
From: <sip:62010201002000000001@10.129.4.13>;tag=3548_661_3776709 To: <sip:62010000002000000001@10.130.140.82>
Max-Forwards: 70
Content-Type: application/MANSCDP+XML Content-Encoding: UTF-8
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK3776709_661_96971908661700620966
Content-Length: 566
 
 
<?xml version='1.0' encoding='UTF-8'?>
<Response>
<CmdType>RecordInfo</CmdType>
<SN>1894</SN>
<DeviceID>62010201001310003793</DeviceID>
<Name>共享镜头01</Name>
<SumNum>2</SumNum>
<RecordList Num='1'>
<Item>
<DeviceID>62010201001310003793</DeviceID>

 
<Name>共享镜头01</Name>
<StartTime>2013-11-06T23:17:32</StartTime>
<EndTime>2013-11-07T00:02:48</EndTime>
<Type>time</Type>
<RecorderID>HWPLATRD-931200007270101-VCURD-ch01_00000000029000000</RecorderID>
</Item>
</RecordList>
</Response>
 
上级--->下级
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK3776709_661_96971908661700620966 From: <sip:62010201002000000001@10.129.4.13>;tag=3548_661_3776709
To: <sip:62010000002000000001@10.130.140.82>;tag=145328459
Call-ID: 8330948e40f07059c8cdccdc02d5aefd@10.129.4.13 CSeq: 1 MESSAGE
User-Agent: Hikvision Content-Length: 0
 
下级--->上级
MESSAGE sip:62010000002000000001@10.130.140.82:7100 SIP/2.0 Call-ID: 4436793e8669679354e09c5d72ffadfb@10.129.4.13
CSeq: 1 MESSAGE
From: <sip:62010201002000000001@10.129.4.13>;tag=3002_661_4301591 To: <sip:62010000002000000001@10.130.140.82>
Max-Forwards: 70
Content-Type: application/MANSCDP+XML Content-Encoding: UTF-8
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK4301591_661_53287493766224157149
Content-Length: 566
 
 
<?xml version='1.0' encoding='UTF-8'?>
<Response>
<CmdType>RecordInfo</CmdType>
<SN>1894</SN>
<DeviceID>62010201001310003793</DeviceID>
<Name>共享镜头01</Name>
<SumNum>2</SumNum>
<RecordList Num='1'>
<Item>
<DeviceID>62010201001310003793</DeviceID>
<Name>共享镜头01</Name>
<StartTime>2013-11-07T00:02:48</StartTime>

 
<EndTime>2013-11-07T00:48:03</EndTime>
<Type>time</Type>
<RecorderID>HWPLATRD-931200007270101-VCURD-ch01_00000000030000000</RecorderID>
</Item>
</RecordList>
</Response>
 
上级--->下级
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK4301591_661_53287493766224157149 From: <sip:62010201002000000001@10.129.4.13>;tag=3002_661_4301591
To: <sip:62010000002000000001@10.130.140.82>;tag=608251420 Call-ID: 4436793e8669679354e09c5d72ffadfb@10.129.4.13
CSeq: 1 MESSAGE
User-Agent: Hikvision 
Content-Length: 0










以上是关于GB28181平台对接接口详解的主要内容,如果未能解决你的问题,请参考以下文章

移动视频类设备&平台国标GB28181输入输出,GB28181平台对接说明

Android平台GB28181接入端如何对接UVC摄像头?

Android平台GB28181接入端如何对接UVC摄像头?

CG28181对接视频流

Android平台GB28181设备接入端如何调节实时音量?

如何实现Android平台GB28181设备对接Camera2数据