|
@@ -11,6 +11,7 @@ import android.net.Uri
|
|
import android.os.Build
|
|
import android.os.Build
|
|
import android.os.Bundle
|
|
import android.os.Bundle
|
|
import android.os.CountDownTimer
|
|
import android.os.CountDownTimer
|
|
|
|
+import android.os.Handler
|
|
import android.provider.Settings
|
|
import android.provider.Settings
|
|
import android.support.v4.app.Fragment
|
|
import android.support.v4.app.Fragment
|
|
import android.support.v4.app.FragmentManager
|
|
import android.support.v4.app.FragmentManager
|
|
@@ -63,6 +64,8 @@ import com.wdkl.ncs.android.middleware.tcp.enums.DeviceTypeEnum
|
|
import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
|
|
import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
|
|
import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
|
|
import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
|
|
import com.wdkl.ncs.android.middleware.utils.MessageEvent
|
|
import com.wdkl.ncs.android.middleware.utils.MessageEvent
|
|
|
|
+import com.wdkl.skywebrtc.EnumType
|
|
|
|
+import com.wdkl.skywebrtc.SkyEngineKit
|
|
import kotlinx.android.synthetic.main.activity_nurse_home.*
|
|
import kotlinx.android.synthetic.main.activity_nurse_home.*
|
|
import kotlinx.android.synthetic.main.right_list.*
|
|
import kotlinx.android.synthetic.main.right_list.*
|
|
import org.greenrobot.eventbus.EventBus
|
|
import org.greenrobot.eventbus.EventBus
|
|
@@ -730,6 +733,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
Constants.CALL_STATE = Constants.CALL_CALLING
|
|
Constants.CALL_STATE = Constants.CALL_CALLING
|
|
DeviceChannel.calling = true
|
|
DeviceChannel.calling = true
|
|
VoiceUtil.acceptAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
VoiceUtil.acceptAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
|
+ checkCallSuccess()
|
|
} else {
|
|
} else {
|
|
DeviceChannel.calling = false
|
|
DeviceChannel.calling = false
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
@@ -933,6 +937,25 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //接听后检查通话是否正常连接上
|
|
|
|
+ private fun checkCallSuccess() {
|
|
|
|
+ //3s还未连接上则判定为通话失败
|
|
|
|
+ Handler().postDelayed({
|
|
|
|
+ val session = SkyEngineKit.Instance().currentSession
|
|
|
|
+ if (session != null && session.state == EnumType.CallState.Connected) {
|
|
|
|
+ //连接通话成功
|
|
|
|
+ } else {
|
|
|
|
+ //没有启动通话界面则判断为通话失败
|
|
|
|
+ if (entraceGuardVideoFragment == null && skyCallFragment == null) {
|
|
|
|
+ showMessage("通话连接失败,通话结束")
|
|
|
|
+ DeviceChannel.calling = false
|
|
|
|
+ Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
|
+ VoiceUtil.rejectAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }, 3000)
|
|
|
|
+ }
|
|
|
|
+
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
fun onMoonEvent(messageEvent: MessageEvent) {
|
|
fun onMoonEvent(messageEvent: MessageEvent) {
|
|
when (messageEvent.getType()) {
|
|
when (messageEvent.getType()) {
|
|
@@ -973,11 +996,8 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
if (SocketManager.getInstance().socketOpen()) {
|
|
if (SocketManager.getInstance().socketOpen()) {
|
|
Constants.CALL_STATE = Constants.CALL_CALLING
|
|
Constants.CALL_STATE = Constants.CALL_CALLING
|
|
DeviceChannel.calling = true
|
|
DeviceChannel.calling = true
|
|
- VoiceUtil.acceptAudioCall(
|
|
|
|
- Constants.ids,
|
|
|
|
- Constants.fromId,
|
|
|
|
- Constants.interactionId
|
|
|
|
- )
|
|
|
|
|
|
+ VoiceUtil.acceptAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
|
+ checkCallSuccess()
|
|
} else {
|
|
} else {
|
|
DeviceChannel.calling = false
|
|
DeviceChannel.calling = false
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|