实现国标GB28181流媒体服务解决方案2016版移动位置订阅流程简述
程序员文章站
2022-03-17 14:02:10
...
GB28181流媒体服务器发展目标
GB28181流媒体服务器已经实现了GB28181协议,能够接入各个厂家的监控设备和监控平台,实现统一管理,和web端无插件播放,同时支持手机、微信、网页播放。
今天我们来讲一下国标GB28181里面的移动位置订阅。移动位置订阅是国标28181-2016版本新出的协议,协议里面对移动位置订阅的描述不是很清晰,因此我们在这边简单规整一下,也简单说明一下移动订阅的流程。
移动订阅的流程
移动位置订阅的包体信息:
<?xml version="1.0"?>
<Query>
<CmdType>MobilePosition</CmdType>
<SN>51</SN>
<DeviceID>64000000001310000001</DeviceID>
<Interval>6</Interval>
</Query>
移动位置取消订阅的包体信息:
<?xml version="1.0"?>
<Query>
<CmdType>MobilePosition</CmdType>
<SN>7</SN>
<DeviceID>64000000001310000001</DeviceID>
</Query>
移动位置通知消息,包体内容:
<?xml version="1.0" ?>
<Notify>
<DeviceID>64000000001310000001</DeviceID>
<CmdType>MobilePosition</CmdType>
<SN>128</SN>
<Time>2017-05-19T10:27:58</Time>
<Longitude>116.336</Longitude>
<Latitude>39.942</Latitude>
<Speed>0.0</Speed>
<Direction>0.0</Direction>
<Altitude>0.0</Altitude>
</Notify>
移动位置订阅消息:
SUBSCRIBE sip:aaa@qq.com:5060 SIP/2.0
Call-ID: aaa@qq.com
CSeq: 1 SUBSCRIBE
From: <sip:aaa@qq.com>;tag=98909488_53173353_53a5809f-9432-4c74-b2f3-1b0d496fc3db
To: <sip:aaa@qq.com:5060>
Max-Forwards: 70
Contact: "34020000002000000001" <sip:192.168.1.81:5060>
Expires: 600
Event: Catalog;id=55
Content-Type: Application/MANSCDP+xml
Via: SIP/2.0/UDP 192.168.1.81:5060;branch=z9hG4bK53a5809f-9432-4c74-b2f3-1b0d496fc3db_53173353_7382400244196
Content-Length: 157
<?xml version="1.0"?>
<Query>
<CmdType>MobilePosition</CmdType>
<SN>51</SN>
<DeviceID>64000000001310000001</DeviceID>
<Interval>6</Interval>
</Query>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.81:5060;branch=z9hG4bK53a5809f-9432-4c74-b2f3-1b0d496fc3db_53173353_7382400244196
From: <sip:aaa@qq.com>;tag=98909488_53173353_53a5809f-9432-4c74-b2f3-1b0d496fc3db
To: <sip:aaa@qq.com:5060>;tag=waUyeIgW
Call-ID: aaa@qq.com
CSeq: 1 SUBSCRIBE
Contact: <sip:aaa@qq.com:5060>
Expires: 600
Content-Length: 0
移动位置上报的抓包信息(由于检测的时候设备还没有设备厂商过了GB28181-2016检测,还是采用的定制海康的设备,包体内容还有些小bug给*一所说了,后面有所修改):
NOTIFY sip:aaa@qq.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.93:5060;rport;branch=z9hG4bK-3d09000-17478ee-Hi8M6Ajh
From: <sip:aaa@qq.com:5060>;tag=waUyeIgW
To: <sip:aaa@qq.com>;tag=98909488_53173353_53a5809f-9432-4c74-b2f3-1b0d496fc3db
Call-ID: aaa@qq.com
CSeq: 2 NOTIFY
Contact: <sip:192.168.1.93:5060>
Content-Type: Application/MANSCDP+xml
Max-Forwards: 70
Event: Catalog;id=55
Subscription-State: active
Content-Length: 310
<?xml version="1.0" encoding="UTF-8"?>
<Notify>
<DeviceID>64000000001310000001</DeviceID>
<CmdType>MobilePosition</CmdType>
<SN>126</SN>
<Time>2017-05-19T10:27:38</Time>
<Longitude>116.336</Longitude>
<Latitude>39.942</Latitude>
<Speed>0.0</Speed>
<Direction>0.0</Direction>
<Altitude>0.0</Altitude>
</Notify>
SIP/2.0 200 OK
To: <sip:aaa@qq.com>;tag=98909488_53173353_53a5809f-9432-4c74-b2f3-1b0d496fc3db
Via: SIP/2.0/UDP 192.168.1.93:5060;rport=5060;branch=z9hG4bK-3d09000-17478ee-Hi8M6Ajh;received=192.168.1.93
CSeq: 2 NOTIFY
Call-ID: aaa@qq.com
From: <sip:aaa@qq.com:5060>;tag=waUyeIgW
Contact: <sip:192.168.1.81:5060>
Content-Length: 0
移动位置取消订阅:
SUBSCRIBE sip:192.168.1.93:5060 SIP/2.0
CSeq: 2 SUBSCRIBE
From: <sip:aaa@qq.com>;tag=98909488_53173353_53a5809f-9432-4c74-b2f3-1b0d496fc3db
To: <sip:aaa@qq.com:5060>;tag=waUyeIgW
Call-ID: aaa@qq.com
Max-Forwards: 70
Contact: <sip:192.168.1.81:5060>
Expires: 0
Event: Catalog;id=55
Content-Type: Application/MANSCDP+xml
Via: SIP/2.0/UDP 192.168.1.81:5060;branch=z9hG4bK53a5809f-9432-4c74-b2f3-1b0d496fc3db_53173353_7422092422952
Content-Length: 150
<?xml version="1.0"?>
<Query>
<CmdType>MobilePosition</CmdType>
<SN>55</SN>
<DeviceID>64000000001310000001</DeviceID>
</Query>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.81:5060;branch=z9hG4bK53a5809f-9432-4c74-b2f3-1b0d496fc3db_53173353_7422092422952
From: <sip:aaa@qq.com>;tag=98909488_53173353_53a5809f-9432-4c74-b2f3-1b0d496fc3db
To: <sip:aaa@qq.com:5060>;tag=waUyeIgW
Call-ID: aaa@qq.com
CSeq: 2 SUBSCRIBE
Contact: <sip:aaa@qq.com:5060>
Expires: 600
Content-Length: 0