|
@@ -1,18 +1,38 @@
|
1
|
1
|
const NodeAPIServer = require('./api/server');
|
2
|
2
|
const NodeGB28181Server = require('./GB28181Server');
|
3
|
3
|
const NodeStreamServer = require('./stream/server');
|
4
|
|
-const config = require('./config');
|
|
4
|
+//const config = require('./config');
|
|
5
|
+const { json } = require('body-parser');
|
|
6
|
+const conf_file = '/etc/noveltv/mserver/conf/sipserver.conf';
|
5
|
7
|
|
6
|
|
-//信令服务
|
7
|
|
-let vagSignalService = new NodeGB28181Server(config);
|
8
|
|
-vagSignalService.run();
|
|
8
|
+const fs = require('fs');
|
|
9
|
+try {
|
|
10
|
+ console.log("---------------------------------");
|
|
11
|
+ console.log("Starting gb28181 sip server...");
|
|
12
|
+ console.log("Version=1.1.0");
|
|
13
|
+ console.log("Powered by BEIJING NOVEL-TV Inc.");
|
|
14
|
+ console.log("http://www.ruiboyun.com");
|
|
15
|
+ console.log("---------------------------------");
|
|
16
|
+
|
|
17
|
+ const data = fs.readFileSync(conf_file, 'utf-8');
|
|
18
|
+ var config = JSON.parse(data);
|
|
19
|
+ if(!config){
|
|
20
|
+ console.log("解析配置文件失败!");
|
|
21
|
+ }else{
|
|
22
|
+ //信令服务
|
|
23
|
+ let vagSignalService = new NodeGB28181Server(config);
|
|
24
|
+ vagSignalService.run();
|
9
|
25
|
|
10
|
|
-//网关API服务
|
11
|
|
-let vagAPIService = new NodeAPIServer(config);
|
12
|
|
-vagAPIService.run();
|
|
26
|
+ //网关API服务
|
|
27
|
+ let vagAPIService = new NodeAPIServer(config);
|
|
28
|
+ vagAPIService.run();
|
13
|
29
|
|
14
|
|
-//流媒体服务
|
15
|
|
-if (config.GB28181.streamServer.enable) {
|
16
|
|
- let vagStreamService = new NodeStreamServer(config);
|
17
|
|
- vagStreamService.run();
|
18
|
|
-}
|
|
30
|
+ //流媒体服务
|
|
31
|
+ if (config.GB28181.streamServer.enable) {
|
|
32
|
+ let vagStreamService = new NodeStreamServer(config);
|
|
33
|
+ vagStreamService.run();
|
|
34
|
+ }
|
|
35
|
+ }
|
|
36
|
+} catch(e) {
|
|
37
|
+ console.log("读取配置文件失败!");
|
|
38
|
+}
|