B接口订阅部分可以参考GB28181的实现,只是body体的不同, 同样是Subscribe方法。有告警时采用Notify的方法进行通知。 抓包如下:
订阅:
代码语言:javascript复制 SUBSCRIBE sip:010090016701000000@192.168.31.185:15060 SIP/2.0
Via: SIP/2.0/UDP 192.168.31.248:21112;rport;branch=z9hG4bK442754586
From: <sip:222222222222222222@192.168.31.248:21112>;tag=3271763341
To: <sip:010090016701000000@192.168.31.185:15060>
Call-ID: 301551777@192.168.31.248
CSeq: 20 SUBSCRIBE
Contact: <sip:222222222222222222@192.168.31.248:21112>
Max-Forwards: 70
User-Agent: hikvision
Expires: 3600
Event: alarm
Content-Type: application/xml
Content-Length: 137
<?xml version="1.0" encoding="UTF-8" ?>
<SIP_XML EventType="Subscribe_Alarm">
<Item Code="010090016701000000" Type="-1"/>
</SIP_XML>
支持的订阅内容:
- 视频丢失告警
- 移动侦测告警
- 视频遮挡告警
- 设备高温告警
- 设备低温告警
- 风扇故障告警
- 磁盘故障告警
- 状态时间告警
告警搜索:
代码语言:javascript复制 MESSAGE sip:010090016701000000@192.168.31.185:15060 SIP/2.0
Via: SIP/2.0/UDP 192.168.31.248:21112;rport;branch=z9hG4bK621604483
From: <sip:222222222222222222@192.168.31.248:21112>;tag=840586094
To: <sip:010090016701000000@192.168.31.185:15060>
Call-ID: 90899755@192.168.31.248
CSeq: 20 MESSAGE
Contact: <sip:222222222222222222@192.168.31.248:21112>
Max-Forwards: 70
User-Agent: hikvision
Content-Type: application/xml
Content-Length: 275
<?xml version="1.0" encoding="UTF-8" ?>
<SIP_XML EventType="Request_History_Alarm">
<Item Code="010090016701000000" UserCode="222222222222222222" Type="-1" BeginTime="2022-05-14T00:00:00Z" EndTime="2022-05-14T23:59:59Z" Level="0" FromIndex="1" ToIndex="101"/>
</SIP_XML>