瀏覽代碼

修改可视通话走webrtc协议

weizhengliang 6 月之前
父節點
當前提交
85f554b0e1

+ 106 - 53
android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/activity/NurseHomeActivity.kt

@@ -2123,7 +2123,6 @@ class NurseHomeActivity: BaseActivity<NurseHomeActivityPresenter, ActivityNurseH
             showMessage(R.string.net_error)
             Constants.CALL_STATE = Constants.CALL_STANDBY
             DeviceChannel.calling = false
-            //VoiceUtil.rejectAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
         }
     }
 
@@ -2214,10 +2213,12 @@ class NurseHomeActivity: BaseActivity<NurseHomeActivityPresenter, ActivityNurseH
                         Constants.CALL_STATE = Constants.CALL_OUTGOING
 
                         if (Constants.tcp_connected && !TextUtils.isEmpty(Constants.sip_id)) {
-                            if (SettingConfig.getSipEnabled(activity)) {
-                                var fragment = SipCallFragment()
+                            //去电直接启动call fragment
+                            //如果是视频通话,走webrtc协议
+                            if (Constants.call_type == 1) {
+                                var fragment = SkyCallFragment()
                                 var bundle = Bundle()
-                                bundle.putBoolean("audio_only", Constants.call_type == 0)
+                                bundle.putBoolean("audio_only", false)
                                 bundle.putInt("call_state", 0)
                                 bundle.putBoolean("visiting", false)
                                 bundle.putString("tcp_tid", tcpModel.tid)
@@ -2239,30 +2240,55 @@ class NurseHomeActivity: BaseActivity<NurseHomeActivityPresenter, ActivityNurseH
                                 fragment.arguments = bundle
                                 addCallFragment(fragment)
                             } else {
-                                //去电直接启动call fragment
-                                var fragment = SkyCallFragment()
-                                var bundle = Bundle()
-                                bundle.putBoolean("audio_only", Constants.call_type == 0)
-                                bundle.putInt("call_state", 0)
-                                bundle.putBoolean("visiting", false)
-                                bundle.putString("tcp_tid", tcpModel.tid)
-                                //bundle.putString("targetId", targetId)
-                                if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
-                                    || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
-                                    || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType
-                                ) {
-                                    //医生机,护士主机,其他主机,总控主机等
-                                    bundle.putString("call_name", interactionVO.toDeviceName)
-                                } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
-                                    //移动设备
-                                    bundle.putString("call_name", interactionVO.toMemberName)
+                                if (SettingConfig.getSipEnabled(activity)) {
+                                    var fragment = SipCallFragment()
+                                    var bundle = Bundle()
+                                    bundle.putBoolean("audio_only", Constants.call_type == 0)
+                                    bundle.putInt("call_state", 0)
+                                    bundle.putBoolean("visiting", false)
+                                    bundle.putString("tcp_tid", tcpModel.tid)
+                                    //bundle.putString("targetId", targetId)
+                                    if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
+                                        || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
+                                        || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType
+                                    ) {
+                                        //医生机,护士主机,其他主机,总控主机等
+                                        bundle.putString("call_name", interactionVO.toDeviceName)
+                                    } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
+                                        //移动设备
+                                        bundle.putString("call_name", interactionVO.toMemberName)
+                                    } else {
+                                        //其他设备
+                                        bundle.putString("call_name", interactionVO.toFrameFullName)
+                                    }
+                                    bundle.putSerializable("interaction", interactionVO)
+                                    fragment.arguments = bundle
+                                    addCallFragment(fragment)
                                 } else {
-                                    //其他设备
-                                    bundle.putString("call_name", interactionVO.toFrameFullName)
+                                    var fragment = SkyCallFragment()
+                                    var bundle = Bundle()
+                                    bundle.putBoolean("audio_only", Constants.call_type == 0)
+                                    bundle.putInt("call_state", 0)
+                                    bundle.putBoolean("visiting", false)
+                                    bundle.putString("tcp_tid", tcpModel.tid)
+                                    //bundle.putString("targetId", targetId)
+                                    if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
+                                        || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
+                                        || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType
+                                    ) {
+                                        //医生机,护士主机,其他主机,总控主机等
+                                        bundle.putString("call_name", interactionVO.toDeviceName)
+                                    } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
+                                        //移动设备
+                                        bundle.putString("call_name", interactionVO.toMemberName)
+                                    } else {
+                                        //其他设备
+                                        bundle.putString("call_name", interactionVO.toFrameFullName)
+                                    }
+                                    bundle.putSerializable("interaction", interactionVO)
+                                    fragment.arguments = bundle
+                                    addCallFragment(fragment)
                                 }
-                                bundle.putSerializable("interaction", interactionVO)
-                                fragment.arguments = bundle
-                                addCallFragment(fragment)
                             }
                         } else {
                             showMessage(R.string.call_init_error)
@@ -2942,8 +2968,10 @@ class NurseHomeActivity: BaseActivity<NurseHomeActivityPresenter, ActivityNurseH
         if (/*entraceGuardVideoFragment == null && */skyCallFragment == null) {
             Constants.CALL_STATE = Constants.CALL_ACCEPT
 
-            if (SettingConfig.getSipEnabled(activity)) {
-                var fragment = SipCallFragment()
+            //如果是视频通话走webrtc协议
+            if (!audioOnly) {
+                Constants.call_type = 1
+                var fragment = SkyCallFragment()
                 var bundle = Bundle()
                 bundle.putInt("call_state", 1)
                 bundle.putBoolean("visiting", false)
@@ -2966,33 +2994,58 @@ class NurseHomeActivity: BaseActivity<NurseHomeActivityPresenter, ActivityNurseH
                 fragment.arguments = bundle
                 addCallFragment(fragment)
             } else {
-                if (audioOnly) {
-                    Constants.call_type = 0
-                } else {
-                    Constants.call_type = 1
-                }
-                var fragment = SkyCallFragment()
-                var bundle = Bundle()
-                bundle.putInt("call_state", 1)
-                bundle.putBoolean("visiting", false)
-                bundle.putBoolean("audio_only", audioOnly)
-                bundle.putString("tcp_tid", tid)
-                if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
-                    || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
-                    || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType
-                ) {
-                    //医生机,护士主机,其他主机,总控主机等
-                    bundle.putString("call_name", interactionVO.fromDeviceName)
-                } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
-                    //移动设备
-                    bundle.putString("call_name", interactionVO.fromMemberName)
+                if (SettingConfig.getSipEnabled(activity)) {
+                    var fragment = SipCallFragment()
+                    var bundle = Bundle()
+                    bundle.putInt("call_state", 1)
+                    bundle.putBoolean("visiting", false)
+                    bundle.putBoolean("audio_only", audioOnly)
+                    bundle.putString("tcp_tid", tid)
+                    if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
+                        || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
+                        || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType
+                    ) {
+                        //医生机,护士主机,其他主机,总控主机等
+                        bundle.putString("call_name", interactionVO.fromDeviceName)
+                    } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
+                        //移动设备
+                        bundle.putString("call_name", interactionVO.fromMemberName)
+                    } else {
+                        //其他设备
+                        bundle.putString("call_name", interactionVO.fromFrameFullName)
+                    }
+                    bundle.putSerializable("interaction", interactionVO)
+                    fragment.arguments = bundle
+                    addCallFragment(fragment)
                 } else {
-                    //其他设备
-                    bundle.putString("call_name", interactionVO.fromFrameFullName)
+                    if (audioOnly) {
+                        Constants.call_type = 0
+                    } else {
+                        Constants.call_type = 1
+                    }
+                    var fragment = SkyCallFragment()
+                    var bundle = Bundle()
+                    bundle.putInt("call_state", 1)
+                    bundle.putBoolean("visiting", false)
+                    bundle.putBoolean("audio_only", audioOnly)
+                    bundle.putString("tcp_tid", tid)
+                    if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
+                        || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
+                        || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType
+                    ) {
+                        //医生机,护士主机,其他主机,总控主机等
+                        bundle.putString("call_name", interactionVO.fromDeviceName)
+                    } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
+                        //移动设备
+                        bundle.putString("call_name", interactionVO.fromMemberName)
+                    } else {
+                        //其他设备
+                        bundle.putString("call_name", interactionVO.fromFrameFullName)
+                    }
+                    bundle.putSerializable("interaction", interactionVO)
+                    fragment.arguments = bundle
+                    addCallFragment(fragment)
                 }
-                bundle.putSerializable("interaction", interactionVO)
-                fragment.arguments = bundle
-                addCallFragment(fragment)
             }
         }
     }

+ 3 - 3
android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SkyCallFragment.kt

@@ -770,17 +770,17 @@ class SkyCallFragment: BaseCallFragment(), CallSessionCallback {
                         if (curTcpModel.action == TcpAction.VideoAction.FAILED) {
                             //分机加入视频失败
                             showMessage(R.string.extension_connect_fail)
-
+                            invitedBed = false
                             return
                         } else if (curTcpModel.action == TcpAction.VideoAction.CALLING) {
                             //分机正在通话
                             showMessage(R.string.extension_call_busy)
-
+                            invitedBed = false
                             return
                         } else if (curTcpModel.action == TcpAction.VideoAction.REJECT) {
                             //分机加入视频通话失败
                             showMessage(R.string.extension_call_error)
-
+                            invitedBed = false
                             return
                         }