|
@@ -7,9 +7,12 @@ import android.os.SystemClock
|
|
|
import android.text.TextUtils
|
|
|
import android.util.Log
|
|
|
import android.view.View
|
|
|
+import android.widget.SeekBar
|
|
|
import com.google.gson.Gson
|
|
|
import com.wdkl.ncs.android.component.nursehome.R
|
|
|
+import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig
|
|
|
import com.wdkl.ncs.android.component.nursehome.util.RingPlayHelper
|
|
|
+import com.wdkl.ncs.android.component.nursehome.util.VoiceManagerUtil
|
|
|
import com.wdkl.ncs.android.lib.base.BaseApplication
|
|
|
import com.wdkl.ncs.android.lib.utils.showMessage
|
|
|
import com.wdkl.ncs.android.middleware.common.Constants
|
|
@@ -35,7 +38,6 @@ class SipCallFragment: BaseCallFragment() {
|
|
|
private val handler = Handler(Looper.getMainLooper())
|
|
|
|
|
|
private var callEnded: Boolean = false
|
|
|
-
|
|
|
private var outGoing: Boolean = false
|
|
|
|
|
|
//呼叫倒计时
|
|
@@ -53,7 +55,7 @@ class SipCallFragment: BaseCallFragment() {
|
|
|
|
|
|
sipCore = WdklSipService.getCore()
|
|
|
|
|
|
-// Log.d(TAG, "callState: $callState, local sip: ${Constants.sip_id}, target sip: ${Constants.targetSipId}")
|
|
|
+ //Log.d(TAG, "callState: $callState, local sip: ${Constants.sip_id}, target sip: ${Constants.targetSipId}")
|
|
|
when (callState) {
|
|
|
0 -> {
|
|
|
//发起通话
|
|
@@ -61,6 +63,7 @@ class SipCallFragment: BaseCallFragment() {
|
|
|
showCallView(true)
|
|
|
Constants.CALL_STATE = Constants.CALL_OUTGOING
|
|
|
DeviceChannel.calling = true
|
|
|
+ Constants.IN_CALL = true
|
|
|
RingPlayHelper.playRingTone(BaseApplication.appContext, R.raw.ring_back2, true)
|
|
|
}
|
|
|
|
|
@@ -70,6 +73,10 @@ class SipCallFragment: BaseCallFragment() {
|
|
|
showCallView(false)
|
|
|
Constants.CALL_STATE = Constants.CALL_CALLING
|
|
|
DeviceChannel.calling = true
|
|
|
+
|
|
|
+ //发送accept消息
|
|
|
+ val callTcp = VoiceUtil.voiceAccept(tid, Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
+ TcpClient.getInstance().sendMsg(callTcp.toJson())
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -86,7 +93,7 @@ class SipCallFragment: BaseCallFragment() {
|
|
|
|
|
|
override fun onFinish() {
|
|
|
//呼叫超时,退出呼叫界面
|
|
|
- showMessage("无响应")
|
|
|
+ showMessage(R.string.no_response)
|
|
|
DeviceChannel.calling = false
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
//VoiceUtil.cancelAudioCall(Constants.ids, Constants.targetDeviceId)
|
|
@@ -119,11 +126,13 @@ class SipCallFragment: BaseCallFragment() {
|
|
|
if (call == null) {
|
|
|
call = sipCore!!.calls[0]
|
|
|
}
|
|
|
- call!!.terminate()
|
|
|
+ call?.terminate()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
override fun destroy() {
|
|
|
+ Constants.showCall = false
|
|
|
+ Constants.IN_CALL = false
|
|
|
RingPlayHelper.stopRingTone()
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
DeviceChannel.calling = false
|
|
@@ -144,6 +153,7 @@ class SipCallFragment: BaseCallFragment() {
|
|
|
}
|
|
|
sky_voice_call_outgoing.visibility = View.VISIBLE
|
|
|
sky_voice_call_timer.visibility = View.GONE
|
|
|
+ Constants.showCall = true
|
|
|
}
|
|
|
|
|
|
private fun showCalling(audioOnly: Boolean) {
|
|
@@ -251,7 +261,7 @@ class SipCallFragment: BaseCallFragment() {
|
|
|
|
|
|
if (sipCore == null || TextUtils.isEmpty(curIt.toSipId)) {
|
|
|
//通话失败,重置并返回主界面
|
|
|
- showMessage("Core或targetSipId为空!")
|
|
|
+ showMessage("Core targetSipId empty!")
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
if (sky_voice_call_timer != null) {
|
|
|
sky_voice_call_timer.stop()
|
|
@@ -268,7 +278,7 @@ class SipCallFragment: BaseCallFragment() {
|
|
|
}
|
|
|
} else if (curTcpModel.action == TcpAction.VoiceAction.REJECT) {//对方拒绝
|
|
|
if (Constants.interactionId == curIt.id) {
|
|
|
- showMessage("对方拒绝")
|
|
|
+ showMessage(R.string.call_reject)
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
DeviceChannel.calling = false
|
|
|
callEnd(false)
|
|
@@ -292,6 +302,7 @@ class SipCallFragment: BaseCallFragment() {
|
|
|
}
|
|
|
|
|
|
Constants.SIP_CONNECTED -> {
|
|
|
+ Constants.IN_CALL = true
|
|
|
showCalling(true)
|
|
|
}
|
|
|
|