国标GB28181平台对接接口详解

1.1 平台注册

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

下级--->上级

REGISTER sip:[email protected]:7100 SIP/2.0  // 62010000002000000001为上级平台ID
Call-ID: [email protected]
CSeq: 1 REGISTER
From: ;tag=5923_661_2647061 // 62010201002000000001为下级平台ID
To: 
Max-Forwards: 70
Contact: 
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: ;tag=5923_661_2647061 
To: ;tag=316765889 
Call-ID: [email protected] 
CSeq: 1 REGISTER 
WWW-Authenticate: Digest realm="1234", nonce="7104983f5477dd30a65167b28553df65", opaque="f10efb1af3e8a362bcda7465284073ce", algorithm=MD5 
User-Agent: Lt_GBS V1.2
Expires: 3600 
Content-Length: 0 

下级--->上级

REGISTER sip:[email protected]:7100 SIP/2.0 
Call-ID: [email protected] 
CSeq: 2 REGISTER 
From: ;tag=5923_661_2647061 
To:  
Max-Forwards: 70 
Contact:  
Via: SIP/2.0/UDP 10.129.4.21:5080;branch=z9hG4bK2647061_661_19459966820285136301
Authorization: Digest username="admin",realm="1234",nonce="7104983f5477dd30a65167b28553df65",uri="sip:[email protected]:7100",response="ceb3a346523335fb0c6d66d24a7e77b5",algorithm=MD5,opaque="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: ;tag=5923_661_2647061 
To: ;tag=300030239 
Call-ID: [email protected]
CSeq: 2 REGISTER 
Contact:  
User-Agent: Lt_GBS V1.2
Date: 2019-12-23T14:45:39 
Content-Length: 0

1.2 平台保活

  • 下级平台定期向上级平台发心跳消息;
  • 定期时间可配置,上下级配置一致;
  • 上级平台连续三次未收到下级心跳消息,则认为下级平台离线;
  • 下级平台连续三次未收到心跳响应,则认为上级平台离线;
  • 举例说明:

下级--->上级

MESSAGE sip:[email protected]:7100 SIP/2.0
Call-ID: [email protected]
CSeq: 1 MESSAGE
From: ;tag=0673_661_2850021
To: 
Max-Forwards: 70
Content-Type: application/Xml
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK2850021_661_35032844903563514200
Content-Length: 138


	Keepalive
	43
	62010201002000000001
	OK

上级--->下级

SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK2850021_661_35032844903563514200
From: ;tag=0673_661_2850021
To: ;tag=1421372822
Call-ID: [email protected]
CSeq: 1 MESSAGE
Content-Length: 0

1.3 平台设备共享

  • 下级平台将设备共享给上级平台,共享关系临时保存在本地数据库;
  • 下级平台收到上级平台的目录查询消息时,返回共享给该上级平台的所有共享设备信息;
  • 上级平台收到目录查询响应结果后,根据设备编码或自定义方式给设备建立目录;
  • 上级平台最好支持定期查询目录和手动查询目录功能,以便及时获取到下级平台新共享的设备;
  • 举例说明:

上级--->下级

MESSAGE sip:[email protected]:5080 SIP/2.0
Via: SIP/2.0/UDP 172.16.3.26:7100;rport;branch=z9hG4bK3420267366
From: ;tag=500485300
To: 
Call-ID: 124958176
CSeq: 20 MESSAGE
Content-Type: Application/MANSCDP+xml
Max-Forwards: 70
User-Agent: Hikvision
Content-Length:   127



Catalog
8903 // 查询消息的序号,下级平台返回的查询响应消息的序号必须和该序号一致,以便标识是该查询的响应
62010201002000000001

下级--->上级

SIP/2.0 200 OK
To: ;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: ;tag=500485300
Content-Length: 0

下级--->上级

MESSAGE sip:[email protected]:7100 SIP/2.0
Call-ID: [email protected]
CSeq: 1 MESSAGE
From: ;tag=7373_661_6058761
To: 
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



	Catalog
	8903   // 和查询请求的序列号一致
	62010201002000000001  // 下级平台ID
	2    // 下级平台共享设备总数
	  // 由于SIP消息长度不能超过1500字节,建议一次只返回一个共享设备信息
	    
			62010401001310004766  // 共享设备ID
			共享镜头01
			hik
			1
			1
			62010201002000000001
			
1
0 1 1 400 62010201002000000001 // 下级平台ID 1 0 0 0.000000 0.000000 ON // 共享设备状态(ON:在线,OFF:离线)

上级--->下级

SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK6058761_661_61989619576009343309
From: ;tag=7373_661_6058761
To: ;tag=3437297396
Call-ID: [email protected]
CSeq: 1 MESSAGE
User-Agent: Hikvision
Content-Length: 0

下级--->上级

MESSAGE sip:[email protected]:7100 SIP/2.0
Call-ID: [email protected]
CSeq: 1 MESSAGE
From: ;tag=5183_661_6342350
To: 
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



	Catalog
	8903
	62010201002000000001
	2
	
		
			62010501001310005076
			共享镜头02
			hik
			1
			1
			62010201002000000001
			
1
0 1 1 400 62010201002000000001 1 0 0 0.000000 0.000000 ON

上级--->下级

SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK6342350_661_77897377155966919994
From: ;tag=5183_661_6342350
To: ;tag=3651745157
Call-ID: [email protected]
CSeq: 1 MESSAGE
User-Agent: Hikvision
Content-Length: 0

备注:

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

1.4  共享设备状态变更通知

  • 下级平台共享设备状态变更时通知给上级平台;
  • 举例说明:

下级--->上级

NOTIFY sip:[email protected]:7100 SIP/2.0
Call-ID: [email protected]
CSeq: 1 NOTIFY
From: ;tag=7373_661_6058761
To: 
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



	Catalog
	3
	62010201002000000001
	1
	
		
			62010401001310004766
			共享镜头01
			hik
			1
			1
			62010201002000000001
			
1
0 1 1 400 62010201002000000001 1 0 0 0.000000 0.000000 OFF

上级--->下级

SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.129.4.13:5080;branch=z9hG4bK6058761_661_61989619576009343309
From: ;tag=7373_661_6058761
To: ;tag=3437297396
Call-ID: [email protected]
CSeq: 1 NOTIFY
User-Agent: Hikvision
Content-Type: application/MANSCDP+XML
Content-Length:   171



Catalog
3
62010201002000000001
OK

 

你可能感兴趣的:(GB28181,sip协议)