Browse Source

去掉sip注册监听

weizhengliang 1 year ago
parent
commit
23cb46439c

+ 3 - 0
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivity.kt

@@ -987,6 +987,9 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
         if (SettingConfig.getSipEnabled(activity)) {
             //配置sip账户
             if (WdklSipService.getCore() != null) {
+                WdklSipService.getCore().clearAllAuthInfo()
+                WdklSipService.getCore().clearProxyConfig()
+
                 mAccountCreator = WdklSipService.getCore().createAccountCreator(null)
                 // 以下三项必须
                 if (!TextUtils.isEmpty(Constant.SIP_ID) && !TextUtils.isEmpty(Constant.sip_ip)) {

+ 4 - 3
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/service/WdklSipService.java

@@ -19,6 +19,7 @@ import com.wdkl.app.ncs.callingbed.activity.CallActivity;
 import com.wdkl.app.ncs.callingbed.activity.CallingbedActivity;
 import com.wdkl.app.ncs.callingbed.settings.SettingConfig;
 import com.wdkl.ncs.android.lib.base.BaseApplication;
+import com.wdkl.ncs.android.lib.utils.ExtendMethodsKt;
 import com.wdkl.ncs.android.middleware.common.Constant;
 import com.wdkl.ncs.android.middleware.common.MessageEvent;
 
@@ -122,7 +123,7 @@ public class WdklSipService extends Service {
                     return;
                 }
 
-                Toast.makeText(WdklSipService.this, message, Toast.LENGTH_SHORT).show();
+                ExtendMethodsKt.showMessage(message);
                 Log.d("sipCall", ">>>>>>>>>>>> call state: " + state + ", " + call.getRemoteAddress().asString());
 
                 if (state == Call.State.IncomingReceived || state == Call.State.IncomingEarlyMedia) {
@@ -145,14 +146,14 @@ public class WdklSipService extends Service {
                 }
             }
 
-            @Override
+            /*@Override
             public void onRegistrationStateChanged(Core core, ProxyConfig cfg, RegistrationState state, String message) {
                 if (!SettingConfig.getSipEnabled(BaseApplication.appContext)) {
                     return;
                 }
 
                 EventBus.getDefault().post(new MessageEvent(state, Constant.EVENT_SIP_REGISTER_STATUS));
-            }
+            }*/
         };
 
         try {

+ 3 - 0
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/activity/NurseHomeActivity.kt

@@ -723,6 +723,9 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNewN
         if (SettingConfig.getSipEnabled(activity)) {
             //配置sip账户
             if (WdklSipService.getCore() != null) {
+                WdklSipService.getCore().clearAllAuthInfo()
+                WdklSipService.getCore().clearProxyConfig()
+
                 mAccountCreator = WdklSipService.getCore().createAccountCreator(null)
                 // 以下三项必须
                 if (!TextUtils.isEmpty(Constant.SIP_ID) && !TextUtils.isEmpty(Constant.sip_ip)) {

+ 2 - 2
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/service/WdklSipService.java

@@ -154,14 +154,14 @@ public class WdklSipService extends Service {
                 }
             }
 
-            @Override
+            /*@Override
             public void onRegistrationStateChanged(Core core, ProxyConfig cfg, RegistrationState state, String message) {
                 if (!SettingConfig.getSipEnabled(BaseApplication.appContext)) {
                     return;
                 }
 
                 EventBus.getDefault().post(new MessageEvent(state, Constant.EVENT_SIP_REGISTER_STATUS));
-            }
+            }*/
         };
 
         try {

+ 3 - 0
android_mobile/src/main/java/com/wdkl/ncs/android/component/home/activity/WatchHome2Activity.kt

@@ -664,6 +664,9 @@ class WatchHome2Activity : BaseActivity<WatchHomeActivityPresenter, WatchActivit
         if (SettingConfig.getSipEnabled(activity)) {
             //配置sip账户
             if (WdklSipService.getCore() != null) {
+                WdklSipService.getCore().clearAllAuthInfo()
+                WdklSipService.getCore().clearProxyConfig()
+
                 mAccountCreator = WdklSipService.getCore().createAccountCreator(null)
                 // 以下三项必须
                 if (!TextUtils.isEmpty(Constant.SIP_ID) && !TextUtils.isEmpty(Constant.sip_ip)) {

+ 4 - 3
android_mobile/src/main/java/com/wdkl/ncs/android/component/home/service/WdklSipService.java

@@ -18,6 +18,7 @@ import com.wdkl.ncs.android.component.home.R;
 import com.wdkl.ncs.android.component.home.activity.CallActivity;
 import com.wdkl.ncs.android.component.home.settingconfig.SettingConfig;
 import com.wdkl.ncs.android.lib.base.BaseApplication;
+import com.wdkl.ncs.android.lib.utils.ExtendMethodsKt;
 import com.wdkl.ncs.android.middleware.common.Constant;
 import com.wdkl.ncs.android.middleware.common.MessageEvent;
 
@@ -119,7 +120,7 @@ public class WdklSipService extends Service {
                     return;
                 }
 
-                Toast.makeText(WdklSipService.this, message, Toast.LENGTH_SHORT).show();
+                ExtendMethodsKt.showMessage(message);
                 Log.d("sipCall", ">>>>>>>>>>>> call state: " + state + ", " + call.getRemoteAddress().asString());
 
                 if (state == Call.State.IncomingReceived || state == Call.State.IncomingEarlyMedia) {
@@ -142,14 +143,14 @@ public class WdklSipService extends Service {
                 }
             }
 
-            @Override
+            /*@Override
             public void onRegistrationStateChanged(Core core, ProxyConfig cfg, RegistrationState state, String message) {
                 if (!SettingConfig.getSipEnabled(BaseApplication.appContext)) {
                     return;
                 }
 
                 EventBus.getDefault().post(new MessageEvent(state, Constant.EVENT_SIP_REGISTER_STATUS));
-            }
+            }*/
         };
 
         try {

+ 3 - 0
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/activity/CallingdoorActivity.kt

@@ -996,6 +996,9 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
         if (SettingConfig.getSipEnabled(activity)) {
             //配置sip账户
             if (WdklSipService.getCore() != null) {
+                WdklSipService.getCore().clearAllAuthInfo()
+                WdklSipService.getCore().clearProxyConfig()
+
                 mAccountCreator = WdklSipService.getCore().createAccountCreator(null)
                 // 以下三项必须
                 if (!TextUtils.isEmpty(Constant.SIP_ID) && !TextUtils.isEmpty(Constant.sip_ip)) {

+ 13 - 12
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/service/WdklSipService.java

@@ -19,6 +19,7 @@ import com.wdkl.app.ncs.callingdoor.R;
 import com.wdkl.app.ncs.callingdoor.activity.CallActivity;
 import com.wdkl.app.ncs.callingdoor.settings.SettingConfig;
 import com.wdkl.ncs.android.lib.base.BaseApplication;
+import com.wdkl.ncs.android.lib.utils.ExtendMethodsKt;
 import com.wdkl.ncs.android.middleware.common.Constant;
 import com.wdkl.ncs.android.middleware.common.MessageEvent;
 
@@ -121,7 +122,7 @@ public class WdklSipService extends Service {
                     return;
                 }
 
-                Toast.makeText(WdklSipService.this, message, Toast.LENGTH_SHORT).show();
+                ExtendMethodsKt.showMessage(message);
                 Log.d("sipCall", ">>>>>>>>>>>> call state: " + state + ", " + call.getRemoteAddress().asString());
 
                 if (state == Call.State.IncomingReceived || state == Call.State.IncomingEarlyMedia) {
@@ -143,25 +144,25 @@ public class WdklSipService extends Service {
                 }
             }
 
-            @Override
+            /*@Override
             public void onRegistrationStateChanged(Core core, ProxyConfig cfg, RegistrationState state, String message) {
                 if (!SettingConfig.getSipEnabled(BaseApplication.appContext)) {
                     return;
                 }
 
                 EventBus.getDefault().post(new MessageEvent(state, Constant.EVENT_SIP_REGISTER_STATUS));
-            }
+            }*/
         };
 
-//        try {
-//            //复制一些源资源
-//            //默认配置只能在首次时安装一次
-//            copyIfNotExist(R.raw.linphonerc_default, basePath + "/.wdkl_sip_rc");
-//            //用户配置,每次复制
-//            copyFromPackage(R.raw.linphonerc_factory, "wdkl_sip_rc");
-//        } catch (IOException ioe) {
-//            Log.e("sipCall",ioe.getMessage());
-//        }
+        try {
+            //复制一些源资源
+            //默认配置只能在首次时安装一次
+            copyIfNotExist(R.raw.linphonerc_default, basePath + "/.wdkl_sip_rc");
+            //用户配置,每次复制
+            copyFromPackage(R.raw.linphonerc_factory, "wdkl_sip_rc");
+        } catch (IOException ioe) {
+            Log.e("sipCall",ioe.getMessage());
+        }
 
         //创建SIP核心并加载监听器
         mCore = Factory.instance()