From 98340bb2bbd3b0c8b877c7d3314023c40f942c02 Mon Sep 17 00:00:00 2001
From: 562935844@qq.com
Date: 星期二, 05 九月 2023 15:59:55 +0800
Subject: [PATCH] 视频监控加enablevideo设置

---
 HDLLinphoneSDKDemoNew/.idea/misc.xml                                                                                   |    5 
 HDLLinphoneSDKDemoNew/.idea/encodings.xml                                                                              |    6 
 Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.sln                                                                  |   50 +++---
 HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml                                                                 |    2 
 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java         |   36 +++-
 HDLLinphoneSDKDemoNew/app/build.gradle                                                                                 |    2 
 HDLLinphoneSDKDemoNew/build.gradle                                                                                     |    2 
 HDLLinphoneSDKDemoNew/gradle/wrapper/gradle-wrapper.properties                                                         |    3 
 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/.gitignore                                                                        |   12 +
 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java     |   30 +++
 /dev/null                                                                                                              |    0 
 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneReverseCallActivity.java |   30 +++
 HDLLinphoneSDKDemoNew/app/.gitignore                                                                                   |   12 +
 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/build.gradle                                                                      |    4 
 HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java                               |    8 
 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java                          |   59 +++++--
 HDLLinphoneSDKDemoNew/gradlew                                                                                          |    0 
 HDLLinphoneSDKDemoNew/gradlew.bat                                                                                      |  168 ++++++++++----------
 HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/LinphoneTestActivity.java                       |   19 +
 HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml                                               |   13 +
 20 files changed, 304 insertions(+), 157 deletions(-)

diff --git a/HDLLinphoneSDKDemoNew/.idea/encodings.xml b/HDLLinphoneSDKDemoNew/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/HDLLinphoneSDKDemoNew/.idea/encodings.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="PROJECT" charset="UTF-8" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/HDLLinphoneSDKDemoNew/.idea/misc.xml b/HDLLinphoneSDKDemoNew/.idea/misc.xml
index 40e47ec..bc936fa 100644
--- a/HDLLinphoneSDKDemoNew/.idea/misc.xml
+++ b/HDLLinphoneSDKDemoNew/.idea/misc.xml
@@ -3,12 +3,17 @@
   <component name="DesignSurface">
     <option name="filePathToZoomLevelMap">
       <map>
+        <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_intercom.xml" value="0.178125" />
+        <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_monitor.xml" value="0.16354166666666667" />
+        <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml" value="0.3536458333333333" />
+        <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml" value="0.3536458333333333" />
         <entry key="HDLLinphoneSDK/src/main/res/drawable/lp_dialog_background.xml" value="0.22291666666666668" />
         <entry key="HDLLinphoneSDK/src/main/res/drawable/lp_line_shape.xml" value="0.22291666666666668" />
         <entry key="app/src/main/res/layout/activity_linphone_test.xml" value="0.20677083333333332" />
       </map>
     </option>
   </component>
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
   <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/build/classes" />
   </component>
diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/.gitignore b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/.gitignore
index 42afabf..efb6d04 100644
--- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/.gitignore
+++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/.gitignore
@@ -1 +1,11 @@
-/build
\ No newline at end of file
+/build
+*.idea
+/.idea/libraries
+/.idea/modules
+/.idea/compiler.xml
+/.idea/gradle.xml
+/.idea/jarRepositories.xml
+/.idea/misc.xml
+/.idea/modules.xml
+/.idea/vcs.xml
+/.idea/workspace.xml
\ No newline at end of file
diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/build.gradle b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/build.gradle
index 1afbb3e..86cfb30 100644
--- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/build.gradle
+++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/build.gradle
@@ -56,7 +56,9 @@
     implementation 'com.android.support.constraint:constraint-layout:2.0.4'
 //    implementation "org.linphone:linphone-sdk-android:4.5.0"
     embed "org.linphone:linphone-sdk-android:4.5.0"
+    implementation 'com.google.code.gson:gson:2.9.0'
 //    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
 
-//    embed(name:'liblinphone-android-sdk', ext: 'aar')
+    embed 'com.tencent.tinker:tinker-patch-gradle-plugin:1.9.1'
+    embed 'com.tencent.tinker:tinker-android-lib:1.9.1'
 }
\ No newline at end of file
diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java
index 37ef91b..efd4222 100644
--- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java
+++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java
@@ -1,7 +1,11 @@
 package com.hdl.hdllinphonesdk;
 
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Build;
+import android.os.IBinder;
 import android.util.Log;
 import android.view.TextureView;
 import android.widget.Toast;
@@ -66,6 +70,7 @@
     private String mUsername, mPassword, mServerIP;
     //    private TextureView mRenderingView, mPreviewView;
     private boolean isAutoJumpCallView;//鏄惁鑷姩璺宠浆鍛煎彨椤甸潰
+    private String intercomeType;
 
     private HDLLinphoneKit() {
 
@@ -144,7 +149,7 @@
             @Override
             public void incomingCall(Call linphoneCall) {
                 super.incomingCall(linphoneCall);
-                Log.d("HDLLinphoneKit","------incomingCall------");
+                Log.d("HDLLinphoneKit", "------incomingCall------");
                 if (linphoneCall != null) {
                     String callUsername = linphoneCall.getRemoteAddress().getUsername();
                     HDLLog.I("鏉ョ數鍙风爜锛�" + callUsername);
@@ -163,21 +168,21 @@
             @Override
             public void outgoingInit() {
                 super.outgoingInit();
-                Log.d("HDLLinphoneKit","------outgoingInit------");
+                Log.d("HDLLinphoneKit", "------outgoingInit------");
             }
 
             @Override
             public void callConnected() {
                 super.callConnected();
                 // 瑙嗛閫氳瘽榛樿鍏嶆彁锛岃闊抽�氳瘽榛樿闈炲厤鎻�
-                Log.d("HDLLinphoneKit","------callConnected------");
+                Log.d("HDLLinphoneKit", "------callConnected------");
                 toggleSpeaker(true);
             }
 
             @Override
             public void callEnd() {
                 super.callEnd();
-                Log.d("HDLLinphoneKit","------callEnd------");
+                Log.d("HDLLinphoneKit", "------callEnd------");
 //                context.sendBroadcast(new Intent(HDLLinphoneIntercomActivity.RECEIVE_FINISH_VIDEO_ACTIVITY));
             }
         });
@@ -196,6 +201,24 @@
         }
     }
 
+    private HDLLinphoneService mService;
+    private final ServiceConnection connection = new ServiceConnection() {
+
+        @Override
+        public void onServiceConnected(ComponentName name, IBinder ibinder) {
+            HDLLinphoneService.LinphoneBinder binder = (HDLLinphoneService.LinphoneBinder) ibinder;
+            mService = binder.getService();
+            //鍒濆鍖�
+            mService.initCore();
+        }
+
+        @Override
+        public void onServiceDisconnected(ComponentName name) {
+            mService = null;
+        }
+
+    };
+
     /**
      * 寮�鍚湇鍔�
      *
@@ -206,12 +229,8 @@
             if (!HDLLinphoneService.isReady()) {
                 Intent intent = new Intent(Intent.ACTION_MAIN);
                 intent.setClass(context, HDLLinphoneService.class);
-                context.startService(intent);
-//                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
-//                    context.startForegroundService(intent);//瑙e喅android8.0浠ヤ笂鏃犳硶鍚姩鏈嶅姟鐨勯棶棰�
-//                } else {
-//                    context.startService(intent);
-//                }
+                context.bindService(intent, connection, Context.BIND_AUTO_CREATE);
+
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -251,7 +270,12 @@
         mUsername = username;
         mPassword = password;
         mServerIP = serverIP;
+        intercomeType = inter_type;
         login(inter_type);
+    }
+
+    public String getIntercomeType() {
+        return intercomeType;
     }
 
     /**
@@ -352,6 +376,8 @@
      * 鐧诲綍 SIP 鏈嶅姟鍣�
      */
     private void loginToServer(String inter_type) {
+        Log.e("==========", "loginToServer: ");
+
         try {
             if (mUsername == null || mPassword == null || mServerIP == null) {
                 throw new RuntimeException("The sip account is not configured.");
@@ -380,7 +406,7 @@
         Core mLinphoneCore = HDLLinphoneService.getCore();
         if (mLinphoneCore == null) return;
 
-        AuthInfo authInfo = Factory.instance().createAuthInfo(name, null, password, null, null, host);
+        AuthInfo authInfo = Factory.instance().createAuthInfo(name, name, password, null, null, host);
         AccountCreator mAccountCreator = mLinphoneCore.createAccountCreator(null);
         mAccountCreator.setUsername(name);
         mAccountCreator.setDomain(host);
@@ -419,6 +445,7 @@
         prxCfg.setQualityReportingCollector(null);
         prxCfg.setQualityReportingInterval(0);
         prxCfg.enableRegister(true);
+        //鍏ㄨ閫氶渶瑕佽缃浐瀹氫唬鐞嗘湇鍔″櫒ip
         prxCfg.setServerAddr("sip:139.159.157.75:46000;transport=udp");
 
         mLinphoneCore.addProxyConfig(prxCfg);//娣诲姞浠g悊閰嶇疆銆傚鏋滃惎鐢ㄤ簡娉ㄥ唽锛岃繖灏嗗紑濮嬪湪浠g悊涓婃敞鍐屻��
@@ -488,7 +515,7 @@
             params.enableLowBandwidth(false);
             params.setAudioBandwidthLimit(0); // disable limitation
             currentCall.acceptWithParams(params);
-            Log.d("HDLLinphoneKit","---acceptCall= ");
+            Log.d("HDLLinphoneKit", "---acceptCall= ");
 
         } catch (Exception e) {
             e.printStackTrace();
@@ -552,7 +579,7 @@
      * 璁剧疆澶栨斁璁惧
      */
     private void routeAudioToSpeakerHelper(boolean speakerOn) {
-        Log.d("HDLLinphoneKit","璁剧疆澶栨斁璁惧[Audio Manager] Routing audio to " + (speakerOn ? "speaker" : "earpiece"));
+        Log.d("HDLLinphoneKit", "璁剧疆澶栨斁璁惧[Audio Manager] Routing audio to " + (speakerOn ? "speaker" : "earpiece"));
         try {
             if (HDLLinphoneService.getCore() == null) return;
             if (HDLLinphoneService.getCore().getCallsNb() == 0) return;
@@ -561,14 +588,14 @@
             if (currentCall == null) return;
 
             for (AudioDevice audioDevice : HDLLinphoneService.getCore().getAudioDevices()) {
-                Log.d("HDLLinphoneKit","audioDevice.getType()= " + audioDevice.getType());
+                Log.d("HDLLinphoneKit", "audioDevice.getType()= " + audioDevice.getType());
             }
 
             for (AudioDevice audioDevice : HDLLinphoneService.getCore().getAudioDevices()) {
-                Log.d("HDLLinphoneKit","璁剧疆澶栨斁璁惧speakerOn=" + speakerOn + " audioDevice.getType()=" + audioDevice.getType());
+                Log.d("HDLLinphoneKit", "璁剧疆澶栨斁璁惧speakerOn=" + speakerOn + " audioDevice.getType()=" + audioDevice.getType());
                 if (speakerOn && audioDevice.getType() == AudioDevice.Type.Speaker) {
                     currentCall.setOutputAudioDevice(audioDevice);
-                    Log.d("HDLLinphoneKit","AudioDevice.Type.Speaker");
+                    Log.d("HDLLinphoneKit", "AudioDevice.Type.Speaker");
                     return;
                 } else if (!speakerOn && audioDevice.getType() == AudioDevice.Type.Earpiece) {
                     currentCall.setOutputAudioDevice(audioDevice);
diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java
index 8f32b3e..3863ab2 100644
--- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java
+++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java
@@ -30,6 +30,7 @@
 import com.hdl.hdllinphonesdk.utils.HDLLog;
 
 import org.linphone.core.Call;
+import org.linphone.core.CallParams;
 import org.linphone.core.Core;
 import org.linphone.core.CoreListenerStub;
 
@@ -56,6 +57,7 @@
 
     //Linphone
     private CoreListenerStub mCoreListener;
+    private boolean enableVideo = false;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -235,7 +237,7 @@
      */
     private void onClickUnlock() {
         try {
-            AlertDialog.Builder builder = new AlertDialog.Builder(this,R.style.CustomAlertDialog);
+            AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.CustomAlertDialog);
             builder.setTitle(R.string.lp_tipStr);
             builder.setMessage(R.string.tip_confirm_unlock);
 
@@ -261,8 +263,8 @@
 
             AlertDialog dialog = builder.create();
             dialog.show();
-        }catch (Exception exception){
-            Log.e(TAG,  exception.getMessage());
+        } catch (Exception exception) {
+            Log.e(TAG, exception.getMessage());
         }
 
     }
@@ -333,8 +335,16 @@
                     // Once call is finished (end state), terminate the activity
                     // We also check for released state (called a few seconds later) just in case
                     // we missed the first one
+                    enableVideo = false;
                     showToast(getString(R.string.lp_endMonitoringStr));
                     finish();
+                } else if (state == Call.State.StreamsRunning) {
+                    if (HDLLinphoneKit.getInstance().getIntercomeType().equals(HDLLinphoneKit.INTER_PHONE_TYPE_HDL)) {
+                        if (!enableVideo) {
+                            enableVideo(core, call);
+                            enableVideo = true;
+                        }
+                    }
                 }
             }
         };
@@ -350,6 +360,20 @@
         }
     }
 
+    void enableVideo(Core core, Call call) {
+//        Call currentCall = HDLLinphoneService.getCore().getCurrentCall();
+
+        CallParams params = call.getCurrentParams();
+        if (params == null) {
+            params = core.createCallParams(call);
+        }
+        params.enableVideo(true);
+        params.enableLowBandwidth(false);
+        params.setAudioBandwidthLimit(0); // disable limitation
+
+        call.update(params);
+    }
+
     /**
      * onDestroyLinphone
      */
diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneReverseCallActivity.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneReverseCallActivity.java
index 9420018..362b933 100644
--- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneReverseCallActivity.java
+++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneReverseCallActivity.java
@@ -32,6 +32,7 @@
 import com.hdl.hdllinphonesdk.utils.HDLLog;
 
 import org.linphone.core.Call;
+import org.linphone.core.CallParams;
 import org.linphone.core.Core;
 import org.linphone.core.CoreListenerStub;
 
@@ -74,6 +75,7 @@
     private CoreListenerStub mCoreListener;
 
     private String deviceSipAccount;//璁惧SIP璐﹀彿
+    private boolean enableVideo = false;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -265,7 +267,7 @@
      */
     private void onClickUnlock() {
         try {
-            AlertDialog.Builder builder = new AlertDialog.Builder(this,R.style.CustomAlertDialog);
+            AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.CustomAlertDialog);
             builder.setTitle(R.string.lp_tipStr);
             builder.setMessage(R.string.tip_confirm_unlock);
 
@@ -291,8 +293,8 @@
 
             AlertDialog dialog = builder.create();
             dialog.show();
-        }catch (Exception exception){
-            Log.e(TAG,  exception.getMessage());
+        } catch (Exception exception) {
+            Log.e(TAG, exception.getMessage());
         }
 
     }
@@ -419,6 +421,13 @@
                     // we missed the first one
                     showToast(getString(R.string.lp_endOfCallStr));
                     finish();
+                } else if (state == Call.State.StreamsRunning) {
+                    if (HDLLinphoneKit.getInstance().getIntercomeType().equals(HDLLinphoneKit.INTER_PHONE_TYPE_HDL)) {
+                        if (!enableVideo) {
+                            enableVideo(core, call);
+                            enableVideo = true;
+                        }
+                    }
                 }
             }
         };
@@ -435,6 +444,21 @@
 
     }
 
+
+    void enableVideo(Core core, Call call) {
+//        Call currentCall = HDLLinphoneService.getCore().getCurrentCall();
+
+        CallParams params = call.getCurrentParams();
+        if (params == null) {
+            params = core.createCallParams(call);
+        }
+        params.enableVideo(true);
+        params.enableLowBandwidth(false);
+        params.setAudioBandwidthLimit(0); // disable limitation
+
+        call.update(params);
+    }
+
     /**
      * onDestroyLinphone
      */
diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java
index 6462798..dacd5a1 100644
--- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java
+++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java
@@ -6,17 +6,22 @@
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
+import android.content.ServiceConnection;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
+import android.os.Binder;
 import android.os.Build;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.SystemClock;
 import android.support.v4.app.NotificationCompat;
+import android.telecom.ConnectionService;
 
 
+import com.google.gson.Gson;
 import com.hdl.hdllinphonesdk.R;
 import com.hdl.hdllinphonesdk.activity.HDLLinphoneIntercomActivity;
 import com.hdl.hdllinphonesdk.activity.HDLLinphoneReverseCallActivity;
@@ -51,7 +56,7 @@
 public class HDLLinphoneService extends Service {
     private static final String START_LINPHONE_LOGS = " ==== HDLLinphoneService ====";
     // Keep a static reference to the Service so we can access it from anywhere in the app
-    private static HDLLinphoneService sInstance;
+    private volatile static HDLLinphoneService sInstance;
 
     private PendingIntent mKeepAlivePendingIntent;
     private static PhoneCallback sPhoneCallback;//閫氳瘽鐘舵�佸洖璋�
@@ -84,9 +89,18 @@
         return sInstance.mCore;
     }
 
+    public class LinphoneBinder extends Binder {
+
+        public HDLLinphoneService getService() {
+            return HDLLinphoneService.this;
+        }
+    }
+
+    private final IBinder binder = new LinphoneBinder();
+
     @Override
     public IBinder onBind(Intent intent) {
-        return null;
+        return binder;
     }
 
     /**
@@ -141,11 +155,17 @@
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
         super.onStartCommand(intent, flags, startId);
+       /* if (sInstance != null) {
+            return START_STICKY;
+        }*/
+        return START_STICKY;
+    }
+
+
+    public void initCore() {
 
         // If our Service is already running, no need to continue
-        if (sInstance != null) {
-            return START_STICKY;
-        }
+
 
         // Our Service has been started, we can keep our reference on it
         // From now one the Launcher will be able to call onServiceReady()
@@ -169,7 +189,6 @@
         mTimer = new Timer("Linphone scheduler");
         mTimer.schedule(lTask, 0, 20);
 
-        return START_STICKY;
     }
 
     @Override
@@ -213,7 +232,7 @@
         String basePath = getFilesDir().getAbsolutePath();
         Factory.instance().setLogCollectionPath(basePath);
         Factory.instance().enableLogCollection(LogCollectionState.Enabled);
-        Factory.instance().setDebugMode(false, getString(R.string.app_name));
+        Factory.instance().setDebugMode(true, "HDLLinphone");
         // Dump some useful information about the device we're running on
 //        HDLLog.I(START_LINPHONE_LOGS);
 //        dumpDeviceInformation();
@@ -260,8 +279,9 @@
             @Override
             public void onRegistrationStateChanged(Core core, ProxyConfig proxyConfig, RegistrationState registrationState, String message) {
                 String state = registrationState.toString();
-                HDLLog.i(START_LINPHONE_LOGS, "registrationState: " + state);
+                HDLLog.i(START_LINPHONE_LOGS, "registrationState: " + state + ",message:" + message);
 
+                HDLLog.i(START_LINPHONE_LOGS, "Registration info=" + new Gson().toJson(proxyConfig));
                 if (state.equals(RegistrationState.None.toString())) {
                     if (sRegistrationCallback != null) {
                         sRegistrationCallback.registrationNone();
diff --git a/HDLLinphoneSDKDemoNew/app/.gitignore b/HDLLinphoneSDKDemoNew/app/.gitignore
index 42afabf..efb6d04 100644
--- a/HDLLinphoneSDKDemoNew/app/.gitignore
+++ b/HDLLinphoneSDKDemoNew/app/.gitignore
@@ -1 +1,11 @@
-/build
\ No newline at end of file
+/build
+*.idea
+/.idea/libraries
+/.idea/modules
+/.idea/compiler.xml
+/.idea/gradle.xml
+/.idea/jarRepositories.xml
+/.idea/misc.xml
+/.idea/modules.xml
+/.idea/vcs.xml
+/.idea/workspace.xml
\ No newline at end of file
diff --git a/HDLLinphoneSDKDemoNew/app/build.gradle b/HDLLinphoneSDKDemoNew/app/build.gradle
index 0724b38..4def722 100644
--- a/HDLLinphoneSDKDemoNew/app/build.gradle
+++ b/HDLLinphoneSDKDemoNew/app/build.gradle
@@ -37,9 +37,7 @@
     implementation 'com.android.support:appcompat-v7:28.0.0'
     implementation 'com.android.support.constraint:constraint-layout:2.0.4'
     implementation project(path: ':HDLLinphoneSDK')
-//    implementation project(path: ':HDLLinphoneSDK')
     testImplementation 'junit:junit:4.+'
     androidTestImplementation 'com.android.support.test:runner:1.0.2'
     androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
-//    implementation project(':HDLLinphoneSDK')
 }
\ No newline at end of file
diff --git a/HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml b/HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml
index 04e8b87..7253355 100644
--- a/HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml
+++ b/HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml
@@ -2,6 +2,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.example.hdllinphonesdkdemo">
 
+
+
     <application
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
diff --git a/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/LinphoneTestActivity.java b/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/LinphoneTestActivity.java
index feab7de..9a5cc42 100644
--- a/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/LinphoneTestActivity.java
+++ b/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/LinphoneTestActivity.java
@@ -10,15 +10,14 @@
 import android.widget.Toast;
 
 import com.hdl.hdllinphonesdk.HDLLinphoneKit;
+import com.hdl.hdllinphonesdk.activity.HDLLinphoneMonitorActivity;
 import com.hdl.hdllinphonesdk.activity.HDLLinphoneReverseCallActivity;
 import com.hdl.hdllinphonesdk.callback.OnHDLLinphoneCallListener;
 
 public class LinphoneTestActivity extends Activity {
 
-    private static final String password = "MITJio1MhRrYXGWXVMoiVmXrR";
-    private static final String serverIP = "47.96.88.250:25060";
-//    private static final String password = "763548";
-//    private static final String serverIP = "139.159.157.75:46000";//""116.62.26.215:35060";
+    private static final String password = "xFNxyrTIM8gLAOGDw3OiuzV5F";
+    private static final String serverIP = "47.96.88.250:25060";//""116.62.26.215:35060";
     private String account = "";
 
     // 鐧诲綍
@@ -27,7 +26,7 @@
 
     // 鍛煎彨
     private EditText numberEdit;
-    private Button callBtn;
+    private Button callBtn,monitorBtn;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -58,6 +57,16 @@
 //            HDLLinphoneKit.getInstance().callTo(number, true);
         });
 
+        monitorBtn = findViewById(R.id.monitor_btn);
+        monitorBtn.setOnClickListener(view -> {
+            String number = numberEdit.getText().toString().trim();
+            if (number.equals("")) return;
+            // 鐩戞帶
+            HDLLinphoneKit.getInstance().callTo(number, true);
+            Intent intent = new Intent(LinphoneTestActivity.this, HDLLinphoneMonitorActivity.class);
+            startActivity(intent);
+        });
+
         //1.鍒濆鍖朣DK锛屽苟娉ㄥ唽HDLLinphoneService
         HDLLinphoneKit.getInstance().initLinphone(this);
         //2.璁剧疆鏄惁鑷姩璺宠浆鍛煎彨,濡傛灉瀵规帴鏋佸厜鎺ㄩ�佸啀寮瑰嚭椤甸潰锛岃繖閲岃璁剧疆false
diff --git a/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java b/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java
index 7399ed2..a8c50eb 100644
--- a/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java
+++ b/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java
@@ -42,10 +42,10 @@
 
         mTextView.setOnClickListener(v -> HDLLinphoneKit.getInstance()
                 .setAccountAndLogin(
-                        "A583853817423247",
-                        "763548",
-                        "139.159.157.75:46000",
-                        HDLLinphoneKit.INTER_PHONE_TYPE_FREEVIEW
+                        "677890543690887170",
+                        "xFNxyrTIM8gLAOGDw3OiuzV5F",
+                        "47.96.88.250:25060",
+                        HDLLinphoneKit.INTER_PHONE_TYPE_HDL
                 ));
 
         mTextView4.setOnClickListener(v -> HDLLinphoneKit.getInstance().setAccountAndLogin("8888", "85521566", "47.96.88.250:35060", HDLLinphoneKit.INTER_PHONE_TYPE_FREEVIEW));
diff --git a/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml b/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml
index 92e73df..4436191 100644
--- a/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml
+++ b/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml
@@ -28,7 +28,7 @@
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:inputType="number"
-            android:text="1544915212865298434"
+            android:text="1677890543690887170"
             />
 
         <Button
@@ -64,7 +64,7 @@
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:inputType="number"
-            android:text="1661666172727111682"
+            android:text="1684889786171437057"
             />
 
         <Button
@@ -75,6 +75,15 @@
             android:paddingEnd="10dp"
             android:text="鍛煎彨"
             android:textSize="18sp" />
+
+        <Button
+            android:id="@+id/monitor_btn"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:paddingStart="10dp"
+            android:paddingEnd="10dp"
+            android:text="鐩戞帶"
+            android:textSize="18sp" />
     </LinearLayout>
 
 </LinearLayout>
\ No newline at end of file
diff --git a/HDLLinphoneSDKDemoNew/build.gradle b/HDLLinphoneSDKDemoNew/build.gradle
index 565e44b..9b33e14 100644
--- a/HDLLinphoneSDKDemoNew/build.gradle
+++ b/HDLLinphoneSDKDemoNew/build.gradle
@@ -5,7 +5,7 @@
         jcenter()
     }
     dependencies {
-        classpath "com.android.tools.build:gradle:4.1.0"
+        classpath "com.android.tools.build:gradle:4.1.2"
         classpath 'com.github.kezong:fat-aar:1.3.6'
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
diff --git a/HDLLinphoneSDKDemoNew/gradle/wrapper/gradle-wrapper.properties b/HDLLinphoneSDKDemoNew/gradle/wrapper/gradle-wrapper.properties
index 8e0b526..a09e6bb 100644
--- a/HDLLinphoneSDKDemoNew/gradle/wrapper/gradle-wrapper.properties
+++ b/HDLLinphoneSDKDemoNew/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,5 @@
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
+#distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
diff --git a/HDLLinphoneSDKDemoNew/gradlew b/HDLLinphoneSDKDemoNew/gradlew
old mode 100755
new mode 100644
diff --git a/HDLLinphoneSDKDemoNew/gradlew.bat b/HDLLinphoneSDKDemoNew/gradlew.bat
index e95643d..f955316 100644
--- a/HDLLinphoneSDKDemoNew/gradlew.bat
+++ b/HDLLinphoneSDKDemoNew/gradlew.bat
@@ -1,84 +1,84 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem  Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.sln b/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.sln
index b0295f6..d6151a0 100644
--- a/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.sln
+++ b/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.sln
@@ -1,25 +1,25 @@
-锘�
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.808.1
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared.Droid.HDLLinphone", "Shared.Droid.HDLLinphone\Shared.Droid.HDLLinphone.csproj", "{703D29ED-674F-44A8-8AAD-863035899D4B}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{703D29ED-674F-44A8-8AAD-863035899D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{703D29ED-674F-44A8-8AAD-863035899D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{703D29ED-674F-44A8-8AAD-863035899D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{703D29ED-674F-44A8-8AAD-863035899D4B}.Release|Any CPU.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {47BF95E2-B6AD-4F82-93B4-D740DFDFA319}
-	EndGlobalSection
-EndGlobal
+锘�
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.808.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared.Droid.HDLLinphone", "Shared.Droid.HDLLinphone\Shared.Droid.HDLLinphone.csproj", "{703D29ED-674F-44A8-8AAD-863035899D4B}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{703D29ED-674F-44A8-8AAD-863035899D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{703D29ED-674F-44A8-8AAD-863035899D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{703D29ED-674F-44A8-8AAD-863035899D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{703D29ED-674F-44A8-8AAD-863035899D4B}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {47BF95E2-B6AD-4F82-93B4-D740DFDFA319}
+	EndGlobalSection
+EndGlobal
diff --git a/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/obj/Release/jl/assets/org.linphone.core/share/doc/liblinphone-4.5.0/c/structprivate_1_1ismapcontainerimpl_3_01t_00_01void__t_3_01typename_01t_1_1key__type_00_01typena75682bb14a0833e99fd03a070051a2d9.png b/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/obj/Release/jl/assets/org.linphone.core/share/doc/liblinphone-4.5.0/c/structprivate_1_1ismapcontainerimpl_3_01t_00_01void__t_3_01typename_01t_1_1key__type_00_01typena75682bb14a0833e99fd03a070051a2d9.png
deleted file mode 100644
index f584519..0000000
--- a/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/obj/Release/jl/assets/org.linphone.core/share/doc/liblinphone-4.5.0/c/structprivate_1_1ismapcontainerimpl_3_01t_00_01void__t_3_01typename_01t_1_1key__type_00_01typena75682bb14a0833e99fd03a070051a2d9.png
+++ /dev/null
Binary files differ

--
Gitblit v1.8.0