562935844@qq.com
2023-09-05 98340bb2bbd3b0c8b877c7d3314023c40f942c02
视频监控加enablevideo设置
1个文件已添加
1个文件已删除
18个文件已修改
209 ■■■■ 已修改文件
HDLLinphoneSDKDemoNew/.idea/encodings.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/.idea/misc.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/HDLLinphoneSDK/.gitignore 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/HDLLinphoneSDK/build.gradle 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneReverseCallActivity.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/app/.gitignore 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/app/build.gradle 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/LinphoneTestActivity.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/build.gradle 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/gradle/wrapper/gradle-wrapper.properties 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/gradlew 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/gradlew.bat 补丁 | 查看 | 原始文档 | blame | 历史
Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.sln 补丁 | 查看 | 原始文档 | blame | 历史
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 补丁 | 查看 | 原始文档 | blame | 历史
HDLLinphoneSDKDemoNew/.idea/encodings.xml
New file
@@ -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>
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>
HDLLinphoneSDKDemoNew/HDLLinphoneSDK/.gitignore
@@ -1 +1,11 @@
/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
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'
}
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() {
@@ -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);//解决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);//添加代理配置。如果启用了注册,这将开始在代理上注册。
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) {
@@ -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
     */
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) {
@@ -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
     */
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 our Service is already running, no need to continue
        if (sInstance != null) {
       /* if (sInstance != null) {
            return START_STICKY;
        }*/
            return START_STICKY;
        }
    public void initCore() {
        // If our Service is already running, no need to continue
        // 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();
HDLLinphoneSDKDemoNew/app/.gitignore
@@ -1 +1,11 @@
/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
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')
}
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"
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.初始化SDK,并注册HDLLinphoneService
        HDLLinphoneKit.getInstance().initLinphone(this);
        //2.设置是否自动跳转呼叫,如果对接极光推送再弹出页面,这里要设置false
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));
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>
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
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
HDLLinphoneSDKDemoNew/gradlew
old mode 100755 new mode 100644
HDLLinphoneSDKDemoNew/gradlew.bat
Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.sln
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
Binary files differ