HappyGBS GB28181信令服务 - 文档

HappyGBS GB28181信令服务 - 开篇

HappyGBS GB28181信令服务 - 运行

HappyGBS GB28181信令服务 - 文档

 

· 数据库设计

 

· API 文档

swagger 地址:http://127.0.0.1:5200/swagger/index.html

 

api/gb28181/list

 

功能:获取gb28181设备及通道信息

 

范例:

 

http://127.0.0.1:5200/api/gb28181/list

 

参数:

 

响应:

 

{

  "data": [

    {

      "deviceDto": {

        "id": 1,

        "deviceId": "34020000001320000013",

        "ip": "192.168.0.13",

        "port": 5060,

        "hearTime": "2022/6/26 6:38:34",

        "offTime": null,

        "status": "REGIST",

        "channelCount": 1,

        "channelDto": [

          {

            "id": 1,

            "deviceId": "34020000001320000013",

            "channelId": "34020000001320000013",

            "name": "IPdome",

            "manufacturer": "Hikvision",

            "address": "Address",

            "status": "ON",

            "rtspUrl_Live": "rtsp://192.168.0.46:554/rtp/2D165855",

            "flvUrl_Live": "http://192.168.0.46:80/rtp/2D165855.live.flv",

            "ssrc_Live": "2D165855",

            "rtspUrl_History": null,

            "flvUrl_History": null,

            "ssrc_History": null,

            "type": "EQUIP"

          }

        ]

      }

    }

  ],

  "code": 0,

  "msg": "操作成功"

}

 

 

api/gb28181/control

 

功能:PTZ控制

 

范例:

http://localhost:5200/api/gb28181/control?deviceId=34020000001320000013&channelId=34020000001320000013&cmd=7&speed=8&preset=0

 

参数:

参数名

必传

含义

deviceId

设备号

channelId

通道号

cmd

操作类型

0:停止;

1:上;

2:左上;

3:右上;

4:下;

5:左下;

6:右下;

7:左;

8:右;

9:变焦+;

10:变焦-;

11:变倍+;

12:变倍-;

13:光圈+;

14:光圈-;

15:设置预置位;

16:请往预置点;

17:删除预置位

speed

速度

preset

预置点

 

响应:

 

{"data":true,"code":0,"msg":"操作成功"}

 

 

api/gb28181/control

 

功能:PTZ控制

 

范例:

http://localhost:5200/api/gb28181/control?deviceId=34020000001320000013&channelId=34020000001320000013&cmd=7&speed=8&preset=0

 

参数:

参数名

必传

含义

deviceId

设备号

channelId

通道号

cmd

操作类型

0:停止;

1:上;

2:左上;

3:右上;

4:下;

5:左下;

6:右下;

7:左;

8:右;

9:变焦+;

10:变焦-;

11:变倍+;

12:变倍-;

13:光圈+;

14:光圈-;

15:设置预置位;

16:请往预置点;

17:删除预置位

speed

速度

preset

预置点

 

 

api/gb28181/live

 

功能:在线直播

 

范例:

http://localhost:5200/api/gb28181/live?deviceId=34020000001320000013&channelId=34020000001320000013

 

参数:

参数名

必传

含义

deviceId

设备号

channelId

通道号

 

响应

 

{

"data": {

"taskNote": "34020000001320000013-34020000001320000013-在线直播",

"taskResult": "执行成功",

"isExcuted": true,

"error": null,

"rtspUrl": "rtsp://192.168.0.46:554/rtp/3A012A3E",

"flvUrl": "http://192.168.0.46:80/rtp/3A012A3E.live.flv",

"ssrc": "3A012A3E",

"autioRtpIp": "",

"autioRtpPort": 0,

"lstRecordItem": null

},

"code": 0,

"msg": "操作成功"

}

 

api/gb28181/history

 

功能:录像点播

 

范例:

http://localhost:5200/api/gb28181/history?deviceId=34020000001320000013&channelId=34020000001320000013&startTime=1656172800&endTime=1655406000

 

参数:

参数名

必传

含义

deviceId

设备号

channelId

通道号

startTime

起始时间戳

endTime

结束时间戳

 

响应

 

{

"data": {

"taskNote": "34020000001320000013-34020000001320000013-录像点播",

"taskResult": "执行成功",

"isExcuted": true,

"error": null,

"rtspUrl": "rtsp://192.168.0.46:554/rtp/3A012A3E",

"flvUrl": "http://192.168.0.46:80/rtp/3A012A3E.live.flv",

"ssrc": "3A012A3E",

"autioRtpIp": "",

"autioRtpPort": 0,

"lstRecordItem": null

},

"code": 0,

"msg": "操作成功"

}

 

{

"data": {

"taskNote": "34020000001320000013-34020000001320000013-录像点播",

"taskResult": "执行失败:任务34020000001320000013-34020000001320000013-录像点播,执行超时",

"isExcuted": false,

"error": "任务34020000001320000013-34020000001320000013-录像点播,执行超时",

"rtspUrl": null,

"flvUrl": null,

"ssrc": null,

"autioRtpIp": "",

"autioRtpPort": 0,

"lstRecordItem": null

},

"code": 0,

"msg": "操作成功"

}

 

· 程序目录结构

 

· 设计架构:前后端分离(前端layui + 后端netcore)

 

抓包文件

 

 

 

// 语音广播通知
// 对讲流程:https://blog.csdn.net/wgg_126/article/details/115373068
// 海康实现:https://blog.csdn.net/qq_38795209/article/details/110953058)
// 摄像头 -> GB28181Server 正常
// 摄像头 -> NVR -> GB28181Server 异常
// 摄像头 -> 下级平台 -> GB28181Server 异常

 

g711 文件制作
ffmpeg -i warn.wav -acodec pcm_alaw -f alaw -ac 1 -ar 8000 -vn warn.g711a
ffplay -i out1_8k.g711a -f alaw -ac 1 -ar 8000

 

zlmediakit 视频播放格式
ws://192.168.3.126:80/rtp/04700258.flv
http://192.168.3.126:80/rtp/04700258.flv
rtsp://192.168.3.126:554/rtp/04700258
rtmp://192.168.3.126:1935/rtp/04700258
http://192.168.3.126:80/rtp/04700258/hls.m3u8
http://192.168.3.126:80/rtp/04700258.live.ts
ws://192.168.3.126:80/rtp/04700258.live.ts
http://192.168.3.126:80/rtp/04700258.live.mp4
ws://192.168.3.126:80/rtp/04700258.live.mp4

zlmediakit api get
文档
https://github.com/ZLMediaKit/ZLMediaKit/wiki/MediaServer%E6%94%AF%E6%8C%81%E7%9A%84HTTP-API

http://127.0.0.1/index/api/getApiList

http://127.0.0.1/index/api/getMediaList
http://127.0.0.1/index/api/close_streams?app=rtp&vhost=__defaultVhost__&force=1&stream=375E26F6

开启录制
http://127.0.0.1/index/api/startRecord?app=rtp&vhost=__defaultVhost__&type=1&stream=2877D758
http://127.0.0.1/index/api/stopRecord?app=rtp&vhost=__defaultVhost__&type=1&stream=2877D758
http://127.0.0.1/index/api/isRecording?app=rtp&vhost=__defaultVhost__&type=1&stream=2877D758

rtpport
http://127.0.0.1/index/api/openRtpServer?port=0&enable_tcp=1&stream_id=37C14CAF
http://127.0.0.1/index/api/closeRtpServer?stream_id=117DEBF0

参考文档
SIP协议错误代码大全
https://www.cnblogs.com/welhzh/p/4620597.html#:~:text=481%20Call%20leg%2Ftransaction%20does%20not%20exist%20%E8%AF%B4%E6%98%8E%20server,CANCEL%20%E3%80%82%20482%20Loop%20detected%20%E8%AF%B4%E6%98%8E%20server%20%E6%94%B6%E5%88%B0%E4%BA%86%E4%B8%80%E4%B8%AA%E5%8C%85%E5%90%AB%E5%AE%83%E8%87%AA%E5%B7%B1%E8%B7%AF%E5%BE%84%E7%9A%84%E8%AF%B7%E6%B1%82.

 

 

zlmediakit优化,配置改为1

#hls协议是否按需生成,如果hls.segNum配置为0(意味着hls录制),那么hls将一直生成(不管此开关)
hls_demand=1
#rtsp[s]协议是否按需生成
rtsp_demand=0
#rtmp[s]、http[s]-flv、ws[s]-flv协议是否按需生成
rtmp_demand=1
#http[s]-ts协议是否按需生成
ts_demand=1
#http[s]-fmp4、ws[s]-fmp4协议是否按需生成
fmp4_demand=0

 

视频无法播放时,请检查ZLMediaKit的端口是否被占用

netstat -aon|findstr "10000"
tasklist|findstr "14124"

 

监测网络数据命令

tcpdump -i ens160 -nnA 'port 5060'

 

流量监测

安装 sudo apt-get install bmon
查看网络 bmon -p eth0

 

posted @ 2022-06-26 12:56  CHHC  阅读(991)  评论(0编辑  收藏  举报