欢迎来到网际学院,让您的头脑满载而归!

GB28181各大平台对接之各种填坑

发布日期:2017-08-21 23:27:17 来源:网际学院 阅读:2004

随着安防行业的规范化,GB28181协议被作为中国安防行业标准应用在各个领域,尤其在交警、公安等政府相关工程应用甚是广泛。但是由于GB28181协议的兴起在最近几年,导致很多大型厂家各自有各自的私自标准,从而导致各个平台之间对接会出现很多的“坑”需要程序员自己来填。

  • GB28181各大平台对接之各种填坑
  • GB28181各大平台对接之各种填坑

GB28181各大平台对接之各种填坑简介

   随着安防行业的规范化,GB28181协议被作为中国安防行业标准应用在各个领域,尤其在交警、公安等政府相关工程应用甚是广泛。但是由于GB28181协议的兴起在最近几年,导致很多大型厂家各自有各自的私自标准,从而导致各个平台之间对接会出现很多的“坑”需要程序员自己来填。

    简单信令对接:

            注册:

                    下级                                        上级

                     register   --------------------->注册 

                         401      <---------------------挑战


          register + auth  --------------------->注册 + 认证

                         200     <---------------------注册成功


REGISTER sip:34020000002000000001@172.8.7.231:5060 SIP/2.0

Via: SIP/2.0/UDP 172.8.25.229:5060;rport=5060;branch=z9hG4bK1312742873;received=172.8.25.229

From: <sip:34040000001320000001@3402000000>;tag=2062427938

To: <sip:34040000001320000001@3402000000>

Call-ID: 992285339

CSeq: 16 REGISTER

Contact: <sip:34040000001320000001@172.8.25.229:5060>

Authorization: Digest username="34040000001320000001",realm="3402000000",nonce="7c9cad3881d5f7ec",uri="sip:34020000002000000001@172.8.7.231:5060",response="4bb3942c63e7c66abcfbe7423287624a",algorithm=MD5

Max-Forwards: 70

User-Agent: IP DOME

Expires: 300

Content-Length: 0

 

 

SIP/2.0 200 OK

To: <sip:34040000001320000001@3402000000>;tag=19760547_53173353_cbcac1ce-75a1-4f3c-9cf8-67c652a650f5

Via: SIP/2.0/UDP 172.8.25.229:5060;rport=5060;branch=z9hG4bK1312742873;received=172.8.25.229

CSeq: 16 REGISTER

Call-ID: 992285339

From: <sip:34040000001320000001@3402000000>;tag=2062427938

Contact: <sip:34040000001320000001@172.8.25.229:5060>

Expires: 300

Date: 2012-10-13T14:48:25.781

TimeRevise: 20121013144825

Content-Length: 0

            Catalog:查询设备 

通过SIP协议中的Message方式发送:


MESSAGE sip:34020000002000000001@3402000000 SIP/2.0

Via: SIP/2.0/UDP 172.8.25.229:5060;rport=5060;branch=z9hG4bK601583960;received=172.8.25.229

From: <sip:34040000001320000001@3402000000>;tag=433496736

To: <sip:34020000002000000001@3402000000>

Call-ID: 1188250942

CSeq: 20 MESSAGE

Content-Type: Application/MANSCDP+xml

Max-Forwards: 70

User-Agent: IP DOME

Content-Length: 874

 

<?xml version="1.0" encoding="UTF-8"?>

<Response>  此处往后为查询反馈的信息

<CmdType>Catalog</CmdType>

<SN>248</SN>

<DeviceID>34020000001110000001</DeviceID>

<SumNum>2</SumNum>

<DeviceList Num="2">

<Item>

<DeviceID>34040000001320000001</DeviceID>

<Name>IPdome</Name>

<Manufacturer>Hikvision</Manufacturer>

<Model>Analog Camera</Model>

<Owner>Owner</Owner>

<CivilCode>CivilCode</CivilCode>

<Address>Address</Address>

<Parental>0</Parental>

<SafetyWay>0</SafetyWay>

<RegisterWay>1</RegisterWay>

<Secrecy>0</Secrecy>

<Status>ON</Status>

</Item>

<Item>

<DeviceID>34040000001340000010</DeviceID>

<Name></Name>

<Manufacturer>Hikvision</Manufacturer>

<Model>AlarmIn</Model>

<Owner>Owner</Owner>

<CivilCode>CivilCode</CivilCode>

<Address>Address</Address>

<Parental>0</Parental>

<SafetyWay>0</SafetyWay>

<RegisterWay>1</RegisterWay>

<Secrecy>0</Secrecy>

<Status>ON</Status>

</Item>

</DeviceList>

</Response>

 

SIP/2.0 200 OK

To: <sip:34020000002000000001@3402000000>;tag=90927290_53173353_d313a445-6e9b-4fce-ac57-505d5caf8c3c

Via: SIP/2.0/UDP 172.8.25.229:5060;rport=5060;branch=z9hG4bK601583960;received=172.8.25.229

CSeq: 20 MESSAGE

Call-ID: 1188250942

From: <sip:34040000001320000001@3402000000>;tag=433496736

Content-Length: 0


在《国家标准GB/T 28181-2011》修改补充文件中提到KeepAlive的添加来保证GB28181的SIP信令保活,很多厂商的实现中各有不同,很多人在这个地方对接失败。

<?xml version="1.0"?>

<Notify>

<CmdType>Keepalive</CmdType>

<SN>477</SN>

<DeviceID>35020000002000000033</DeviceID>

<Status>OK</Status>

</Notify>

SIP/2.0 200 OK

Via: SIP/2.0/UDP 35.48.80.13:5060;rport=5060;branch=z9hG4bK2064543340

From: <sip:35020000002000000033@3502000000>;tag=2885546634

To: <sip:35020300002000000033@3502030000>;tag=1012347531

Call-ID: 1629627632

CSeq: 20 MESSAGE

User-Agent: Embedded Net DVR/NVR/DVS

Content-Length: 0

还有很多厂家设置一些“坑”让对接变得难上加难:

比如在invite之后,根据GB28181协议,本该是直接向sdp协商端口出流,然后sip信令层任务结束,等待下级发送停止。但是很多厂家设限,例如科达厂商就会在传输层上面加上rtcp的限制,所以,此处需要做rtcp的保活,再开一个端口去做rtcp的协商,不让下级设备断流。


这里附上本人的测试软件以及联系方式,如果感兴趣可以下载使用一下

软件测试地址:

http://download.csdn.net/detail/qq_24798461/9820447?locationNum=1&fps=1


GB28181各大平台对接之各种填坑
GB28181各大平台对接之各种填坑
Copyright oneie ©2014-2017 All Rights Reserved. 所有资料来源于互联网对相关版权责任概不负责。如发现侵犯了您的版权请与我们联系。 网际学院 版权所有
免责声明  商务合作及投稿请联系 QQ:86662817