DZ先生怪谈国标之视音频文件检索

版权声明: https://blog.csdn.net/dzxs_gb28181/article/details/84952099

自述
今天DZ先生主讲的内容是关于录像检索,讲它一方面是为了让大家了解GB上下级之间的录像查询流程,另一方面是为了让更多的工程师懂得如何去排查问题,因为在更多的实际情况中,我们需要做的更多的是排查问题。如果您看完了本篇文章,相信您在工作中遇到此类问题,可以迎刃而解。

经典组网

检索流程

信令流程描述如下:
a) 1: 目录检索方向目录拥有方发送目录查询请求 Message 消息, 消息体中包含视音频文件检索条件;
b) 2: 目录拥有方向目录检索方发送200 OK, 无消息体;
c) 3: 目录拥有方向目录检索方发送查询结果, 消息体中含文件目录, 当一条 Message 消息无法传送完所有查询结果时, 采用多条消息传送;(GB28181附录 N 多响应消息传输的要求)
d) 4: 目录检索方向目录拥有方发送200 OK, 无消息体。

文件目录检索请求
< ! -- 命令类型: 文件目录检索(必选) -->
<element name="CmdType" fixed ="RecordInfo" />
< ! -- 命令序列号(必选) -->
<element name="SN" type="integer" minInclusive value = "1" />---多响应消息,这个SN值是相同的
< ! -- 目录设备/视频监控联网系统/区域编码(必选) -->
<element name="DeviceID" type="tg:deviceIDType" />
< ! -- 录像起始时间(必选)-->
<element name ="StartTime" type="dateTime"/>
< ! -- 录像终止时间(必选)-->
<element name ="EndTime" type="dateTime" />
< ! -- 文件路径名 (可选)-->
<element name=" FilePath" type="string"/>
< ! -- 录像地址(可选 支持不完全查询) -->
<element name="Address" type="string"/>
< ! -- 保密属性(可选) 缺省为0;0: 不涉密,1: 涉密-->
<element name="Secrecy" type="integer" minInclusive value = "1"/>
< ! -- 录像产生类型(可选)time 或alarm 或 manual 或all-->
<element name="Type" type="string"/>
< ! -- 录像触发者ID(可选)-->
<element name="RecorderID" type="string"/>
< ! --录像模糊查询属性( 可选) 缺省为0;0: 不进行模糊查询, 此时根据 SIP 消息中 To 头域
URI 中的ID 值确定查询录像位置, 若ID 值为本域系统ID 则进行中心历史记录检索, 若为前
端设备ID 则进行前端设备历史记录检索;1: 进行模糊查询, 此时设备所在域应同时进行中心
检索和前端检索并将结果统一返回。 -->

<element name="IndistinctQuery" type="string"/>

现实案例
1. 上级向下级查询录像,抓包总体报文

第一条message是检索的报文,下面的message消息是下级给上级的回复。
如何确定是检索消息还是keepalive保活消息,可以查看message body体里的<cmdtype>字段,这个表示是录像检索
 这个表示保活

2. 检索消息体字段解释
<Query>
<CmdType>RecordInfo</CmdType>----------------------录像查询
<SN>10715</SN>---------------------------------------------命令序列号,多响应消息,此值相同
<DeviceID>32028101021320000009</DeviceID>----相机ID
<StartTime>2018-12-06T00:00:00</StartTime>-------录像开始时间
<EndTime>2018-12-06T23:59:59</EndTime>---------录像结束时间
<Type>time</Type>-------------------------------------------根据时间查询
<FilePath>32028101021320000009</FilePath>------文件路径
<Address>Address1</Address>---------------------------录像地址,支持不完全查询
<Secrecy>0</Secrecy>---------------------------------------默认为0代表,不涉密
<RecorderID>32028101021320000009</RecorderID>-录像触发者ID
<IndistinctQuery>0</IndistinctQuery>-----------------------0:不进行模糊查询

3. 下级回复
<?xml version="1.0"?>
<Response>
<CmdType>RecordInfo</CmdType>
<SN>10715</SN>-------------------------------命令序列号同查询的相同
<DeviceID>32028101021320000009</DeviceID>
<Name>....3</Name>
<SumNum>31</SumNum>
<RecordList Num="10">-----------------------10条记录<item>项
<Item>
<DeviceID>32028101021320000009</DeviceID>
<Name>....3</Name>
<FilePath>1544024318_1544026472</FilePath>
<Address>Address 1</Address>
<StartTime>2018-12-05T23:38:38</StartTime>----回复的录像开始时间
<EndTime>2018-12-06T00:14:32</EndTime>--------录像的结束时间
<Secrecy>0</Secrecy>
<Type>time</Type>
</Item>
<Item>
<DeviceID>32028101021320000009</DeviceID>
<Name>....3</Name>
<FilePath>1544026472_1544028625</FilePath>
<Address>Address 1</Address>
<StartTime>2018-12-06T00:14:32</StartTime>--开始
<EndTime>2018-12-06T00:50:25</EndTime>------结束
<Secrecy>0</Secrecy>
<Type>time</Type>
</Item>
<Item>
<DeviceID>32028101021320000009</DeviceID>
<Name>....3</Name>
<FilePath>1544028625_1544030780</FilePath>
<Address>Address 1</Address>
<StartTime>2018-12-06T00:50:25</StartTime>--开始
<EndTime>2018-12-06T01:26:20</EndTime>------结束
<Secrecy>0</Secrecy>
<Type>time</Type>
</Item>
<Item>
<DeviceID>32028101021320000009</DeviceID>
<Name>....3</Name>
<FilePath>1544030780_1544032934</FilePath>
<Address>Address 1</Address>
<StartTime>2018-12-06T01:26:20</StartTime>---开始
<EndTime>2018-12-06T02:02:14</EndTime>-------结束
<Secrecy>0</Secrecy>
<Type>time</Type>
</Item>
<Item>
<DeviceID>32028101021320000009</DeviceID>
<Name>....3</Name>
<FilePath>1544032934_1544035087</FilePath>
<Address>Address 1</Address>
<StartTime>2018-12-06T02:02:14</StartTime>--开始
<EndTime>2018-12-06T02:38:07</EndTime>------结束
<Secrecy>0</Secrecy>
<Type>time</Type>
</Item>
<Item>
<DeviceID>32028101021320000009</DeviceID>
<Name>....3</Name>
<FilePath>1544035087_1544037242</FilePath>
<Address>Address 1</Address>
<StartTime>2018-12-06T02:38:07</StartTime>---开始
<EndTime>2018-12-06T03:14:02</EndTime>-------结束
<Secrecy>0</Secrecy>
<Type>time</Type>
</Item>
<Item>
<DeviceID>32028101021320000009</DeviceID>
<Name>....3</Name>
<FilePath>1544037242_1544039396</FilePath>
<Address>Address 1</Address>
<StartTime>2018-12-06T03:14:02</StartTime>--开始
<EndTime>2018-12-06T03:49:56</EndTime>------结束
<Secrecy>0</Secrecy>
<Type>time</Type>
</Item>
<Item>
<DeviceID>32028101021320000009</DeviceID>
<Name>....3</Name>
<FilePath>1544039396_1544041549</FilePath>
<Address>Address 1</Address>
<StartTime>2018-12-06T03:49:56</StartTime>--开始
<EndTime>2018-12-06T04:25:49</EndTime>------结束
<Secrecy>0</Secrecy>
<Type>time</Type>
</Item>
<Item>
<DeviceID>32028101021320000009</DeviceID>
<Name>....3</Name>
<FilePath>1544041549_1544043703</FilePath>
<Address>Address 1</Address>
<StartTime>2018-12-06T04:25:49</StartTime>----开始
<EndTime>2018-12-06T05:01:43</EndTime>--------结束
<Secrecy>0</Secrecy>
<Type>time</Type>
</Item>
<Item>
<DeviceID>32028101021320000009</DeviceID>
<Name>....3</Name>
<FilePath>1544043703_1544045859</FilePath>
<Address>Address 1</Address>
<StartTime>2018-12-06T05:01:43</StartTime>----开始
<EndTime>2018-12-06T05:37:39</EndTime>--------结束
<Secrecy>0</Secrecy>
<Type>time</Type>
</Item>
</RecordList>
</Response>

这条message消息携带了10条,根据多响应消息的定义:
为缩短传输时间宜在每条响应消息中携带多条记录, 每条响应消息携带记录上限为10000条
所以现在知道为啥可以一次性携带这么多条了吧,也知道为啥回复的message消息有多条了吧。

另外将所有回复的时间加在一起则为整段时间。


***关注DZ君,让监控变得更简单***

猜你喜欢

转载自blog.csdn.net/dzxs_gb28181/article/details/84952099