Bladeren bron

## [1.1.54] version 72 - 2020-08-21
### Changed
- 改善TCP重连
- 对方挂断逻辑完善

allen 3 jaren geleden
bovenliggende
commit
85a05b3d6c

+ 1 - 4
.gitignore

@@ -6,10 +6,7 @@
 /build
 /captures
 .externalNativeBuild
-<<<<<<< HEAD
 .gradle/4.4/fileHashes/fileHashes.bin
 .gradle/4.4/fileHashes/fileHashes.lock
-=======
-.gradle
+.gradle/*
 .idea
->>>>>>> c9df07eda6e810c75f1abe78d37ee0c421bfcd04

BIN
.gradle/4.10.1/fileHashes/fileHashes.bin


BIN
.gradle/4.10.1/fileHashes/fileHashes.lock


BIN
.gradle/4.10.1/fileHashes/resourceHashesCache.bin


BIN
.gradle/4.10.1/javaCompile/classAnalysis.bin


BIN
.gradle/4.10.1/javaCompile/javaCompile.lock


BIN
.gradle/4.10.1/javaCompile/taskHistory.bin


BIN
.gradle/4.10.1/taskHistory/taskHistory.bin


BIN
.gradle/4.10.1/taskHistory/taskHistory.lock


+ 2 - 2
build.gradle

@@ -47,12 +47,12 @@ buildscript {
     /**
      * APP版本码
      */
-    ext.app_version_code = 71
+    ext.app_version_code = 72
 
     /**
      * APP版本号
      */
-    ext.app_version = "1.1.53"
+    ext.app_version = "1.1.54"
 
     /**
      * 项目依赖库

+ 31 - 23
home/src/main/code/com/wdkl/ncs/android/component/home/activity/WebRTCVoipAudioActivity.kt

@@ -135,26 +135,16 @@ class WebRTCVoipAudioActivity : Activity(), View.OnClickListener, CallSessionCal
             call_duration_tv.start()
         }, 2900)
 
-        //6秒后仍然未连接,则断开
-        Handler().postDelayed({
-            Log.i(TAG,"session state:"+gEngineKit?.currentSession?.state+",userState:"+ SocketManager.getInstance().userState)
-            if (gEngineKit?.currentSession?.state != EnumType.CallState.Connected){
-                showMessage("连接失败,请重试")
-
-                gEngineKit?.endCall()
-                val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
-                val voiceUtilTcpModel = VoiceUtil.voiceHandoff(Constants.deviceId, tcpModel.toId, interactionVO.id)
-                TcpClient.getInstance().sendMsg(voiceUtilTcpModel.toJson())
-                finish()
-            }
-        },6000)
-
         val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
         if ((interactionVO.fromClerkId!=null && interactionVO.fromClerkId>=0) && interactionVO.fromDeviceId!=Constants.deviceId){
-//            Handler().postDelayed({
-//
-//            },1000)
-            //等待准备接听事件分发后,加入房间
+            //6秒后仍然未连接,则断开
+            Handler().postDelayed({
+                Log.i(TAG,"session state:"+gEngineKit?.currentSession?.state+",userState:"+ SocketManager.getInstance().userState)
+                if (gEngineKit?.currentSession?.state != EnumType.CallState.Connected){
+                    showMessage("连接失败,请重试")
+                    finish()
+                }
+            },6000)
         } else {
             if (createEnabled) {
                 var room = UUID.randomUUID().toString() + System.currentTimeMillis()
@@ -172,6 +162,21 @@ class WebRTCVoipAudioActivity : Activity(), View.OnClickListener, CallSessionCal
                     Log.d(TAG + "_peer", " 呼出状态: myId = ${session?.mMyId} , targetId = ${session?.mTargetId}, roomId = ${session?.roomId}, state = ${session?.state}, outCallResult = $outCallResult")
                     if (outCallResult!!||session.state == EnumType.CallState.Connected || session.state == EnumType.CallState.Connecting) {
                         setAudioDeviceOut(session)
+
+                        //6秒后仍然未连接,则断开
+                        Handler().postDelayed({
+                            Log.i(TAG,"session state:"+gEngineKit?.currentSession?.state+",userState:"+ SocketManager.getInstance().userState)
+                            if (gEngineKit?.currentSession?.state != EnumType.CallState.Connected){
+                                showMessage("连接失败,请重试")
+
+                                gEngineKit?.endCall()
+                                val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
+                                val voiceUtilTcpModel = VoiceUtil.voiceHandoff(Constants.deviceId, tcpModel.toId, interactionVO.id)
+                                TcpClient.getInstance().sendMsg(voiceUtilTcpModel.toJson())
+                                finish()
+                            }
+                        },6000)
+
                     } else {
                         if (session.state != EnumType.CallState.Idle) {
                             showMessage("对方忙线中2")
@@ -296,11 +301,14 @@ class WebRTCVoipAudioActivity : Activity(), View.OnClickListener, CallSessionCal
                 }
                 val currentTnVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
                 if (interactionVO!!.id == currentTnVO.id){
-                    call_duration_tv.stop()
-                    showMessage("对方挂断")
-                    createEnabled = false
-                    gEngineKit?.endCall()
-                    finish()
+
+                    if (tcpModel.fromId != Constants.deviceId) {
+                        showMessage("对方挂断")
+                        call_duration_tv.stop()
+                        createEnabled = false
+                        gEngineKit?.endCall()
+                        finish()
+                    }
                 }
             } else if (tcpModel.action === TcpAction.VoiceAction.REJECT) {
                 var interactionVO: InteractionVO? = null

+ 4 - 1
middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/TcpClient.java

@@ -57,8 +57,11 @@ public class TcpClient {
         }
 
         if (bootstrap!=null){
+            if (channel!=null) {
+                channel.disconnect();
+                channel = null;
+            }
             bootstrap = null;
-            channel = null;
             workGroup = null;
         }
 

+ 7 - 0
readme.md

@@ -26,6 +26,13 @@
 
 ---
 
+## [1.1.54] version 72 - 2020-08-21
+### Changed
+- 改善TCP重连
+- 对方挂断逻辑完善
+
+---
+
 ## [1.1.53] version 71 - 2020-08-21
 ### Changed
 - 改善TCP重连