視頻監控安防平台-GB28181-2016版-移動位置訂閱


視頻監控安防平台-GB28181-2016版-移動位置訂閱

鄭重聲明: 本位來自 CSDN博主「沉睡的思緒」,查看原文,請點擊下面鏈接,
原文鏈接:https://blog.csdn.net/songxiao1988918/article/details/78641811 

我轉載此文,主要做個記錄。       

由於項目原因最近還是好久沒更新博客了,一直想把移動位置訂閱這個更新上去避免檢測的時候遇到和我一樣的問題。移動位置訂閱是國標28181-2016版本新出的協議,協議里面對移動位置訂閱的描述不是很清晰,檢測的時候還單純的以為是移動位置查詢,結果檢測的時候傻眼了,一看還有移動位置訂閱 移動位置取消訂閱 移動位置上班的檢測項,瞬間就知道是理解錯了,最后只能趁檢測人員午休的時候現改代碼,下面說一下移動訂閱的簡單流程。

1、訂閱和取消訂閱流程 


直接參考28181文檔里面的訂閱流程:
移動位置訂閱的包體信息:
<?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>
2、移動位置通知流程

移動位置通知消息,包體內容:
<?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:64000000001310000001@192.168.1.93:5060 SIP/2.0
Call-ID: 4ef921da0c61d38df35ed9794b79e6fd@0.0.0.0
CSeq: 1 SUBSCRIBE
From: <sip:34020000002000000001@3402000000>;tag=98909488_53173353_53a5809f-9432-4c74-b2f3-1b0d496fc3db
To: <sip:64000000001310000001@192.168.1.93: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:34020000002000000001@3402000000>;tag=98909488_53173353_53a5809f-9432-4c74-b2f3-1b0d496fc3db
To: <sip:64000000001310000001@192.168.1.93:5060>;tag=waUyeIgW
Call-ID: 4ef921da0c61d38df35ed9794b79e6fd@0.0.0.0
CSeq: 1 SUBSCRIBE
Contact: <sip:64000000001310000001@192.168.1.93:5060>
Expires: 600
Content-Length: 0


移動位置上報的抓包信息(由於檢測的時候設備還沒有設備廠商過了GB28181-2016檢測,還是采用的定制海康的設備,包體內容還有些小bug給公安一所說了,后面有所修改):
NOTIFY sip:34020000002000000001@3402000000 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.93:5060;rport;branch=z9hG4bK-3d09000-17478ee-Hi8M6Ajh
From: <sip:64000000001310000001@192.168.1.93:5060>;tag=waUyeIgW
To: <sip:34020000002000000001@3402000000>;tag=98909488_53173353_53a5809f-9432-4c74-b2f3-1b0d496fc3db
Call-ID: 4ef921da0c61d38df35ed9794b79e6fd@0.0.0.0
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:34020000002000000001@3402000000>;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: 4ef921da0c61d38df35ed9794b79e6fd@0.0.0.0
From: <sip:64000000001310000001@192.168.1.93: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:34020000002000000001@3402000000>;tag=98909488_53173353_53a5809f-9432-4c74-b2f3-1b0d496fc3db
To: <sip:64000000001310000001@192.168.1.93:5060>;tag=waUyeIgW
Call-ID: 4ef921da0c61d38df35ed9794b79e6fd@0.0.0.0
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:34020000002000000001@3402000000>;tag=98909488_53173353_53a5809f-9432-4c74-b2f3-1b0d496fc3db
To: <sip:64000000001310000001@192.168.1.93:5060>;tag=waUyeIgW
Call-ID: 4ef921da0c61d38df35ed9794b79e6fd@0.0.0.0
CSeq: 2 SUBSCRIBE
Contact: <sip:64000000001310000001@192.168.1.93:5060>
Expires: 600
Content-Length: 0
————————————————

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM