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

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

    简单信令对接:

            注册:

                    下级                                        上级

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

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

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

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

REGISTER sip:[email protected]:5060 SIP/2.0

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

From: ;tag=2062427938

To:

Call-ID: 992285339

CSeq: 16 REGISTER

Contact:

Authorization: Digest username="34040000001320000001",realm="3402000000",nonce="7c9cad3881d5f7ec",uri="sip:[email protected]:5060",response="4bb3942c63e7c66abcfbe7423287624a",algorithm=MD5

Max-Forwards: 70

User-Agent: IP DOME

Expires: 300

Content-Length: 0

 

 

SIP/2.0 200 OK

To: ;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: ;tag=2062427938

Contact:

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: ;tag=433496736

To:

Call-ID: 1188250942

CSeq: 20 MESSAGE

Content-Type: Application/MANSCDP+xml

Max-Forwards: 70

User-Agent: IP DOME

Content-Length: 874

 

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

Catalog

248

34020000001110000001

2

34040000001320000001

IPdome

Hikvision

Analog Camera

Owner

CivilCode

Address

0

0

1

0

ON

34040000001340000010

Hikvision

AlarmIn

Owner

CivilCode

Address

0

0

1

0

ON

 

SIP/2.0 200 OK

To: ;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: ;tag=433496736

Content-Length: 0


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

Keepalive

477

35020000002000000033

OK


SIP/2.0 200 OK

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

From: ;tag=2885546634

To: ;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

如果大家有对接方面的问题欢迎咨询我的Chat快问:





你可能感兴趣的:(C++,GB28181)