Browse Source

增加ssrcs接口

ntv-wangjian 3 years ago
parent
commit
83eee362f7
3 changed files with 21 additions and 1 deletions
  1. 3
    0
      GB28181Server.js
  2. 17
    1
      api/controllers/vag.js
  3. 1
    0
      api/routes/vag.js

+ 3
- 0
GB28181Server.js View File

200
 
200
 
201
                     let dialogs = [];
201
                     let dialogs = [];
202
 
202
 
203
+                    //ntv removed
204
+                    /** 
203
                     context.dialogs.forEach(dialog => {
205
                     context.dialogs.forEach(dialog => {
204
                         if (dialog.deviceId === userId)
206
                         if (dialog.deviceId === userId)
205
                             dialogs.push(dialog);
207
                             dialogs.push(dialog);
212
                             context.dialogs.splice(index, 1);
214
                             context.dialogs.splice(index, 1);
213
                         }
215
                         }
214
                     });
216
                     });
217
+                    */
215
 
218
 
216
                     session.request = request;
219
                     session.request = request;
217
                 }
220
                 }

+ 17
- 1
api/controllers/vag.js View File

14
     
14
     
15
     return msg;
15
     return msg;
16
 }
16
 }
17
+
18
+//获取正在直播的ssrc列表
19
+function getSsrcs(req, res) {
20
+    let result = { code: 0, err_desc: 'OK' };
21
+    var arr = [];
22
+    this.ssrcs.forEach(function (obj, ssrc) {
23
+        obj.ssrc = ssrc;
24
+        arr.push(obj);
25
+    });
26
+    result.code = 0;
27
+    result.data = {};
28
+    result.data.count=arr.length;
29
+    result.data.items = arr;
30
+    res.json(result);
31
+}
32
+
17
 //获取所有SIP会话
33
 //获取所有SIP会话
18
 function getSessions(req, res, next) {
34
 function getSessions(req, res, next) {
19
     let result = { code: 0, err_desc: 'OK' ,data:{}};
35
     let result = { code: 0, err_desc: 'OK' ,data:{}};
298
     return (Array(m).join(0) + num).slice(-m);
314
     return (Array(m).join(0) + num).slice(-m);
299
 }
315
 }
300
 
316
 
301
-module.exports = { getCatalog: getCatalog, realplay: realplay, getSessions: getSessions, playback: playback, ptzControl: ptzControl, playControl: playControl, recordQuery: recordQuery, closeStream: closeStream }
317
+module.exports = { getSsrcs: getSsrcs, getCatalog: getCatalog, realplay: realplay, getSessions: getSessions, playback: playback, ptzControl: ptzControl, playControl: playControl, recordQuery: recordQuery, closeStream: closeStream }

+ 1
- 0
api/routes/vag.js View File

3
 
3
 
4
 module.exports = (context) => {
4
 module.exports = (context) => {
5
   let router = express.Router();
5
   let router = express.Router();
6
+  router.get('/ssrcs', vagController.getSsrcs.bind(context));
6
   router.get('/devices', vagController.getSessions.bind(context));
7
   router.get('/devices', vagController.getSessions.bind(context));
7
   router.get('/devices/:device', vagController.getCatalog.bind(context));
8
   router.get('/devices/:device', vagController.getCatalog.bind(context));
8
   router.get('/devices/:device/:channel/realplay/:action/:host/:port/:mode', vagController.realplay.bind(context));
9
   router.get('/devices/:device/:channel/realplay/:action/:host/:port/:mode', vagController.realplay.bind(context));

Loading…
Cancel
Save