Selaa lähdekoodia

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

ntv-wangjian 3 vuotta sitten
vanhempi
commit
f7209f657c
2 muutettua tiedostoa jossa 10 lisäystä ja 8 poistoa
  1. 5
    1
      GB28181Server.js
  2. 5
    7
      GB28181Session.js

+ 5
- 1
GB28181Server.js Näytä tiedosto

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

+ 5
- 7
GB28181Session.js Näytä tiedosto

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

Loading…
Peruuta
Tallenna