|
@@ -151,8 +151,10 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
Constant.DEVICE_REGISTER_ID = Constant.LOCAL_MAC
|
|
Constant.DEVICE_REGISTER_ID = Constant.LOCAL_MAC
|
|
}
|
|
}
|
|
|
|
|
|
- //启动sip服务
|
|
|
|
- startService(Intent().setClass(this, WdklSipService::class.java))
|
|
|
|
|
|
+ if (Constant.enableSip) {
|
|
|
|
+ //启动sip服务
|
|
|
|
+ startService(Intent().setClass(this, WdklSipService::class.java))
|
|
|
|
+ }
|
|
|
|
|
|
//presenter.loadTcpServerHost()
|
|
//presenter.loadTcpServerHost()
|
|
//注册广播
|
|
//注册广播
|
|
@@ -962,21 +964,23 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
|
|
|
presenter.loadPartSettings(Constant.PART_ID)
|
|
presenter.loadPartSettings(Constant.PART_ID)
|
|
|
|
|
|
- //配置sip账户
|
|
|
|
- if (WdklSipService.getCore() != null) {
|
|
|
|
- mAccountCreator = WdklSipService.getCore().createAccountCreator(null)
|
|
|
|
- // 以下三项必须
|
|
|
|
- if (!TextUtils.isEmpty(Constant.TCP_SERVER_URL) && !TextUtils.isEmpty(Constant.SIP_ID)) {
|
|
|
|
- mAccountCreator!!.setDomain(Constant.TCP_SERVER_URL)
|
|
|
|
- mAccountCreator!!.setUsername(Constant.SIP_ID)
|
|
|
|
- mAccountCreator!!.setPassword(Constant.SIP_ID)
|
|
|
|
- //默认使用udp
|
|
|
|
- mAccountCreator!!.transport = TransportType.Udp
|
|
|
|
-
|
|
|
|
- // 这里会自动创建代理配置、认证信息到 SIP核心
|
|
|
|
- val cfg = mAccountCreator!!.createProxyConfig()
|
|
|
|
- // 确保新创建的是最新
|
|
|
|
- WdklSipService.getCore().defaultProxyConfig = cfg
|
|
|
|
|
|
+ if (Constant.enableSip) {
|
|
|
|
+ //配置sip账户
|
|
|
|
+ if (WdklSipService.getCore() != null) {
|
|
|
|
+ mAccountCreator = WdklSipService.getCore().createAccountCreator(null)
|
|
|
|
+ // 以下三项必须
|
|
|
|
+ if (!TextUtils.isEmpty(Constant.TCP_SERVER_URL) && !TextUtils.isEmpty(Constant.SIP_ID)) {
|
|
|
|
+ mAccountCreator!!.setDomain(Constant.TCP_SERVER_URL)
|
|
|
|
+ mAccountCreator!!.setUsername(Constant.SIP_ID)
|
|
|
|
+ mAccountCreator!!.setPassword(Constant.SIP_ID)
|
|
|
|
+ //默认使用udp
|
|
|
|
+ mAccountCreator!!.transport = TransportType.Udp
|
|
|
|
+
|
|
|
|
+ // 这里会自动创建代理配置、认证信息到 SIP核心
|
|
|
|
+ val cfg = mAccountCreator!!.createProxyConfig()
|
|
|
|
+ // 确保新创建的是最新
|
|
|
|
+ WdklSipService.getCore().defaultProxyConfig = cfg
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1162,6 +1166,10 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (!Constant.enableSip) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
//通话之前先判断webrtc socket和tcp是否连接正常,否则不能建立通话
|
|
//通话之前先判断webrtc socket和tcp是否连接正常,否则不能建立通话
|
|
if (Constant.TCP_CONNECTED) {
|
|
if (Constant.TCP_CONNECTED) {
|
|
//去电界面
|
|
//去电界面
|
|
@@ -1179,6 +1187,10 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
|
|
|
//开始呼叫分机
|
|
//开始呼叫分机
|
|
fun startCallBed(type: Int, bedId: Int) {
|
|
fun startCallBed(type: Int, bedId: Int) {
|
|
|
|
+ if (!Constant.enableSip) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
//通话之前先判断webrtc socket和tcp是否连接正常,否则不能建立通话
|
|
//通话之前先判断webrtc socket和tcp是否连接正常,否则不能建立通话
|
|
if (Constant.TCP_CONNECTED) {
|
|
if (Constant.TCP_CONNECTED) {
|
|
//去电界面
|
|
//去电界面
|
|
@@ -1235,6 +1247,10 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
Constant.fromDeviceType = interactionVO.fromDeviceType
|
|
Constant.fromDeviceType = interactionVO.fromDeviceType
|
|
Constant.CALL_STATE = Constant.CALL_INCOMING
|
|
Constant.CALL_STATE = Constant.CALL_INCOMING
|
|
if (Constant.TCP_CONNECTED && !TextUtils.isEmpty(Constant.SIP_ID)) {
|
|
if (Constant.TCP_CONNECTED && !TextUtils.isEmpty(Constant.SIP_ID)) {
|
|
|
|
+ if (!Constant.enableSip) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
//来电界面
|
|
//来电界面
|
|
var fragment = SipCallFragment()
|
|
var fragment = SipCallFragment()
|
|
var bundle = Bundle()
|
|
var bundle = Bundle()
|
|
@@ -1621,14 +1637,6 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
inner class TimeReceiver: BroadcastReceiver() {
|
|
inner class TimeReceiver: BroadcastReceiver() {
|
|
override fun onReceive(context: Context, intent: Intent) {
|
|
override fun onReceive(context: Context, intent: Intent) {
|
|
if (intent.action == Intent.ACTION_TIME_TICK) {
|
|
if (intent.action == Intent.ACTION_TIME_TICK) {
|
|
- //更新sip注册状态
|
|
|
|
- /*if (WdklSipService.getCore() != null) {
|
|
|
|
- val proxyConfig = WdklSipService.getCore().defaultProxyConfig
|
|
|
|
- if (proxyConfig != null) {
|
|
|
|
- updateSipState(proxyConfig.state)
|
|
|
|
- }
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
updateNetState()
|
|
updateNetState()
|
|
if (initialized) {
|
|
if (initialized) {
|
|
updateSettings(false)
|
|
updateSettings(false)
|