|
@@ -78,6 +78,7 @@ import org.greenrobot.eventbus.EventBus
|
|
|
import org.greenrobot.eventbus.Subscribe
|
|
|
import org.greenrobot.eventbus.ThreadMode
|
|
|
import org.linphone.core.AccountCreator
|
|
|
+import org.linphone.core.Factory
|
|
|
import org.linphone.core.RegistrationState
|
|
|
import org.linphone.core.TransportType
|
|
|
import java.io.File
|
|
@@ -251,7 +252,6 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
home_view_qr_code?.setImageBitmap(code)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 初始化 GStreamer
|
|
|
try {
|
|
|
GStreamer.init(BaseApplication.appContext)
|
|
@@ -510,19 +510,14 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
currentFragment = FramePartFragment()
|
|
|
supportFragmentManager.beginTransaction().replace(R.id.middle_fralyout, currentFragment, "").commitAllowingStateLoss()
|
|
|
|
|
|
- currentFragmentThree = CallRecordsFragment()
|
|
|
- supportFragmentManager.beginTransaction().replace(R.id.left_framlyout, currentFragmentThree, "").commitAllowingStateLoss()
|
|
|
+ //currentFragmentThree = CallRecordsFragment()
|
|
|
+ //supportFragmentManager.beginTransaction().replace(R.id.left_framlyout, currentFragmentThree, "").commitAllowingStateLoss()
|
|
|
|
|
|
//presenter.loadTcpData()
|
|
|
presenter.loadServerInfo()
|
|
|
|
|
|
regReceiver()//注册广播
|
|
|
|
|
|
- /*if(Constants.hospital_name!=null&& !Constants.hospital_name.equals("")){
|
|
|
- name_of_organization_tv.text = Constants.hospital_name+ Constants.part_name
|
|
|
- Log.e(TAG, Constants.hospital_name+ Constants.part_name)
|
|
|
- }*/
|
|
|
-
|
|
|
name_of_organization_tv.text = Constants.partDisplay
|
|
|
Log.e(TAG, Constants.partDisplay)
|
|
|
|
|
@@ -549,12 +544,12 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
|
|
|
startScheduledExecutor()
|
|
|
|
|
|
- SettingConfiguration.getInstance().transferCall = SettingConfig.getTransferCall(activity)
|
|
|
+ /*SettingConfiguration.getInstance().transferCall = SettingConfig.getTransferCall(activity)
|
|
|
if (SettingConfiguration.getInstance().transferCall) {
|
|
|
startTransferScheduledExecutor()
|
|
|
} else {
|
|
|
startRemoveCallScheduledExecutor()
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
//记录app启动时间
|
|
|
val lastTime = SettingConfig.getAppStartTime(activity)
|
|
@@ -835,6 +830,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
collocation_radio_bt.setOnClickListener(this)
|
|
|
system_settings_radio_bt.setOnClickListener(this)
|
|
|
led_settings_radio_bt.setOnClickListener(this)
|
|
|
+ sip_call_radio_bt.setOnClickListener(this)
|
|
|
|
|
|
//home_view_btn_reload.isEnabled = false
|
|
|
home_view_btn_reload.setOnClickListener {
|
|
@@ -1069,7 +1065,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
|
|
|
if (SettingConfig.getSipEnabled(activity)) {
|
|
|
//配置sip账户
|
|
|
- if (WdklSipService.getCore() != null) {
|
|
|
+ /*if (WdklSipService.getCore() != null) {
|
|
|
mAccountCreator = WdklSipService.getCore().createAccountCreator(null)
|
|
|
// 以下三项必须
|
|
|
if (!TextUtils.isEmpty(Constants.sip_id) && !TextUtils.isEmpty(Constants.sip_ip)) {
|
|
@@ -1087,7 +1083,22 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
} else {
|
|
|
showMessage("SIP 数据不全")
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
+
|
|
|
+
|
|
|
+ //无服务器时端口必须,固定5060,否则拨打IP时,也需加上端口号。如:sip:192.168.1.100:6666
|
|
|
+ val transports = Factory.instance().createTransports()
|
|
|
+ transports.setUdpPort(5060)
|
|
|
+ transports.setTcpPort(5060)
|
|
|
+ WdklSipService.getCore().setTransports(transports)
|
|
|
+
|
|
|
+ //设置显示名称
|
|
|
+ val accountCreator = WdklSipService.getCore().createAccountCreator(null)
|
|
|
+ accountCreator.setUsername(Constants.sip_id) //此处就当设置为房间床位号
|
|
|
+ accountCreator.setDomain(NetHelper.getInstance().getLocalIP())
|
|
|
+ accountCreator.setTransport(TransportType.Udp)
|
|
|
+ val cfg = accountCreator.createProxyConfig()
|
|
|
+ WdklSipService.getCore().setDefaultProxyConfig(cfg)
|
|
|
}
|
|
|
|
|
|
loadLedDevice()
|
|
@@ -1260,6 +1271,20 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
select_id = 10
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ R.id.sip_call_radio_bt -> {
|
|
|
+ if (select_id != 11) {
|
|
|
+ select_id = 11
|
|
|
+
|
|
|
+ val fragment = SipComingCallFragment()
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putInt("call_state", 0)
|
|
|
+ bundle.putBoolean("visiting", false)
|
|
|
+ bundle.putBoolean("audio_only", true)
|
|
|
+ fragment.arguments = bundle
|
|
|
+ addCallFragment(fragment)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1523,7 +1548,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
VoiceManagerUtil.switchAudioMode(activity, true)
|
|
|
VoiceManagerUtil.setCallVoice(activity, SettingConfig.getHostCallVolume(activity))
|
|
|
|
|
|
- if (Constants.CALL_STATE == Constants.CALL_OUTGOING) {
|
|
|
+ /*if (Constants.CALL_STATE == Constants.CALL_OUTGOING) {
|
|
|
//呼出取消
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
DeviceChannel.calling = false
|
|
@@ -1533,7 +1558,9 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
DeviceChannel.calling = false
|
|
|
EventBus.getDefault().post(MessageEvent("handoff", Constants.EVENT_END_CALL))
|
|
|
- }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ EventBus.getDefault().post(MessageEvent("handoff", Constants.EVENT_END_CALL))
|
|
|
}
|
|
|
|
|
|
hookonTime = System.currentTimeMillis()
|
|
@@ -1545,12 +1572,14 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
VoiceManagerUtil.switchAudioMode(activity, false)
|
|
|
VoiceManagerUtil.setCallVoice(activity, SettingConfig.getHostCallVolume(activity))
|
|
|
|
|
|
- if (Constants.CALL_STATE == Constants.CALL_STANDBY) {
|
|
|
+ /*if (Constants.CALL_STATE == Constants.CALL_STANDBY) {
|
|
|
//不是呼出也不是通话状态则接听电话
|
|
|
EventBus.getDefault().post(MessageEvent("hookoff", Constants.EVENT_HOOK_OFF))
|
|
|
} else if (Constants.CALL_STATE == Constants.CALL_VISITING || Constants.CALL_STATE == Constants.CALL_V_INCOMING) {
|
|
|
EventBus.getDefault().post(MessageEvent("hookoff", Constants.EVENT_V_HOOK_OFF))
|
|
|
- }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ EventBus.getDefault().post(MessageEvent("hookoff", Constants.EVENT_HOOK_OFF))
|
|
|
}
|
|
|
|
|
|
hookoffTime = System.currentTimeMillis()
|
|
@@ -1911,7 +1940,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
if (tcpModel.action == TcpAction.SOSAction.CALL || tcpModel.action == TcpAction.SOSAction.ROOM_CALL) {
|
|
|
//紧急呼叫优先级最高,如果当前有通话或正在呼叫的需要将其打断
|
|
|
RingPlayHelper.stopRingTone()
|
|
|
- SpeechUtil.getInstance().stopSpeak()
|
|
|
+ SpeechUtil.getInstance().stopSpeak(false)
|
|
|
if (Constants.CALL_STATE == Constants.CALL_OUTGOING) {
|
|
|
VoiceUtil.cancelAudioCall(Constants.ids, Constants.targetDeviceId)
|
|
|
EventBus.getDefault().post(MessageEvent("cancel", Constants.EVENT_END_CALL))
|
|
@@ -2147,7 +2176,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
}else if (tcpModel.type == TcpType.ENTRACEGUARD) {
|
|
|
if (tcpModel.action == TcpAction.EntraceGuardAction.STRANGER) {
|
|
|
if(Constants.CALL_STATE == Constants.CALL_STANDBY) { //空闲状态
|
|
|
- SpeechUtil.getInstance().stopSpeak()
|
|
|
+ SpeechUtil.getInstance().stopSpeak(true)
|
|
|
RingPlayHelper.stopRingTone()
|
|
|
|
|
|
Constants.CALL_STATE = Constants.CALL_CALLING
|
|
@@ -2220,7 +2249,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
Constants.fromDeviceType = item.fromDeviceType
|
|
|
//callInteractionVO = interactionVO
|
|
|
|
|
|
- SpeechUtil.getInstance().stopSpeak()
|
|
|
+ SpeechUtil.getInstance().stopSpeak(true)
|
|
|
RingPlayHelper.stopRingTone()
|
|
|
|
|
|
//通话之前先判断webrtc socket是否连接上,否则不能建立通话
|
|
@@ -2237,6 +2266,18 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
LedHelper.updateLedInfo(item, false, false)
|
|
|
}
|
|
|
|
|
|
+ Constants.SIP_INCOMING_CALL -> {
|
|
|
+ val callName = messageEvent.getMessage() as String
|
|
|
+ val fragment = SipComingCallFragment()
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putInt("call_state", 1)
|
|
|
+ bundle.putBoolean("visiting", false)
|
|
|
+ bundle.putBoolean("audio_only", true)
|
|
|
+ bundle.putString("call_name", callName)
|
|
|
+ fragment.arguments = bundle
|
|
|
+ addCallFragment(fragment)
|
|
|
+ }
|
|
|
+
|
|
|
Constants.EVENT_REJECT_CALL -> {
|
|
|
//拒接电话
|
|
|
val item = messageEvent.getMessage() as InteractionVO
|