|
@@ -135,26 +135,16 @@ class WebRTCVoipAudioActivity : Activity(), View.OnClickListener, CallSessionCal
|
|
call_duration_tv.start()
|
|
call_duration_tv.start()
|
|
}, 2900)
|
|
}, 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)
|
|
val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
if ((interactionVO.fromClerkId!=null && interactionVO.fromClerkId>=0) && interactionVO.fromDeviceId!=Constants.deviceId){
|
|
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 {
|
|
} else {
|
|
if (createEnabled) {
|
|
if (createEnabled) {
|
|
var room = UUID.randomUUID().toString() + System.currentTimeMillis()
|
|
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")
|
|
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) {
|
|
if (outCallResult!!||session.state == EnumType.CallState.Connected || session.state == EnumType.CallState.Connecting) {
|
|
setAudioDeviceOut(session)
|
|
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 {
|
|
} else {
|
|
if (session.state != EnumType.CallState.Idle) {
|
|
if (session.state != EnumType.CallState.Idle) {
|
|
showMessage("对方忙线中2")
|
|
showMessage("对方忙线中2")
|
|
@@ -296,11 +301,14 @@ class WebRTCVoipAudioActivity : Activity(), View.OnClickListener, CallSessionCal
|
|
}
|
|
}
|
|
val currentTnVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
val currentTnVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
if (interactionVO!!.id == currentTnVO.id){
|
|
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) {
|
|
} else if (tcpModel.action === TcpAction.VoiceAction.REJECT) {
|
|
var interactionVO: InteractionVO? = null
|
|
var interactionVO: InteractionVO? = null
|