Browse Source

BugFixs, TODO 设备离线状态需要精确获知

ntv-wangjian 3 years ago
parent
commit
f7209f657c
2 changed files with 10 additions and 8 deletions
  1. 5
    1
      GB28181Server.js
  2. 5
    7
      GB28181Session.js

+ 5
- 1
GB28181Server.js View File

222
             }
222
             }
223
             else {
223
             else {
224
                 //新的设备加入
224
                 //新的设备加入
225
+                Logger.log(`[${userId}] new sip session start.`);
225
                 let session = new NodeSipSession(this.config, userId, { request: request, info: remote }, this.uas);
226
                 let session = new NodeSipSession(this.config, userId, { request: request, info: remote }, this.uas);
226
                 session.expires = expires || this.expires;
227
                 session.expires = expires || this.expires;
227
                 session.run(this.authModule,auto_play);
228
                 session.run(this.authModule,auto_play);
229
         }
230
         }
230
         else {
231
         else {
231
             //注销
232
             //注销
232
-            if (context.sessions.has(userId))
233
+            if (context.sessions.has(userId)){
234
+                Logger.log(`[${userId}] lotout.`);
233
                 context.nodeEvent.emit('logout', context.sessions.get(userId));
235
                 context.nodeEvent.emit('logout', context.sessions.get(userId));
236
+            }
237
+                
234
         }
238
         }
235
 
239
 
236
         //通过验证 ,增加 Date 字段 (上下级和设备之间校时功能) 
240
         //通过验证 ,增加 Date 字段 (上下级和设备之间校时功能) 

+ 5
- 7
GB28181Session.js View File

111
         //ntv 提交状态,自动开启视频... 
111
         //ntv 提交状态,自动开启视频... 
112
         this.authModule = authModule;
112
         this.authModule = authModule;
113
         this.auto_play  = auto_play;
113
         this.auto_play  = auto_play;
114
-        authModule.status(this.id,1,(data)=>{
114
+        this.authModule.status(this.id,1,(data)=>{
115
             if(data.code==0){
115
             if(data.code==0){
116
                 Logger.log("设备在线状态已上报!");
116
                 Logger.log("设备在线状态已上报!");
117
             }else{
117
             }else{
894
 
894
 
895
                                     //ntv
895
                                     //ntv
896
                                     that.playmode='realplay';
896
                                     that.playmode='realplay';
897
-                                    this.authModule.play_status(this.id,1,(data)=>{
897
+                                    that.authModule.play_status(that.id,1,(data)=>{
898
                                         if(data.code==0){
898
                                         if(data.code==0){
899
                                             Logger.log("视频开启状态已上报!");
899
                                             Logger.log("视频开启状态已上报!");
900
                                         }else{
900
                                         }else{
917
 
917
 
918
     //停止实时预览
918
     //停止实时预览
919
     async sendStopRealPlayMessage(channelId, rhost, rport) {
919
     async sendStopRealPlayMessage(channelId, rhost, rport) {
920
-
921
         return new Promise((resolve, reject) => {
920
         return new Promise((resolve, reject) => {
922
-            let result = { result: false, message: 'not find dialog.' };
921
+            let result = { result: false, message: '没有找到视频通道!' };
923
 
922
 
924
             for (var key in this.dialogs) {
923
             for (var key in this.dialogs) {
925
                 //搜索满足条件的会话
924
                 //搜索满足条件的会话
926
                 let session = this.dialogs[key];
925
                 let session = this.dialogs[key];
927
-
928
-                if (session.bye && session.port === rport && session.host === rhost && session.channelId === channelId && session.play === 'realplay') {
929
-
926
+                //ntv  注释掉多余条件,因为数据类型不同导致找不到
927
+                if (session.bye /*&& session.port === rport && session.host === rhost */ && session.channelId === channelId && session.play === 'realplay') {
930
                     //ntv 挪到回调中,TODO 这个指令发不成功!
928
                     //ntv 挪到回调中,TODO 这个指令发不成功!
931
                     //context.nodeEvent.emit('stopPlayed', session.ssrc);
929
                     //context.nodeEvent.emit('stopPlayed', session.ssrc);
932
                     this.uas.send(session.bye, (response) => {
930
                     this.uas.send(session.bye, (response) => {

Loading…
Cancel
Save