562935844@qq.com
2022-06-28 e048ba4c93af976d074bf9ca56c23557f9104e04
HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java
@@ -144,6 +144,7 @@
            @Override
            public void incomingCall(Call linphoneCall) {
                super.incomingCall(linphoneCall);
                Log.d("HDLLinphoneKit","------incomingCall------");
                if (linphoneCall != null) {
                    String callUsername = linphoneCall.getRemoteAddress().getUsername();
                    HDLLog.I("来电号码:" + callUsername);
@@ -162,19 +163,21 @@
            @Override
            public void outgoingInit() {
                super.outgoingInit();
                Log.d("HDLLinphoneKit","------outgoingInit------");
            }
            @Override
            public void callConnected() {
                super.callConnected();
                // 视频通话默认免提,语音通话默认非免提
                Log.d("HDLLinphoneKit","------callConnected------");
                toggleSpeaker(true);
            }
            @Override
            public void callEnd() {
                super.callEnd();
                Log.d("HDLLinphoneKit","------callEnd------");
//                context.sendBroadcast(new Intent(HDLLinphoneIntercomActivity.RECEIVE_FINISH_VIDEO_ACTIVITY));
            }
@@ -477,8 +480,11 @@
            Call currentCall = HDLLinphoneService.getCore().getCurrentCall();
            CallParams params = HDLLinphoneService.getCore().createCallParams(currentCall);
            params.enableVideo(true);
            params.enableLowBandwidth(false);
            params.setAudioBandwidthLimit(0); // disable limitation
            currentCall.acceptWithParams(params);
            Log.d("HDLLinphoneKit","---acceptCall= ");
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -541,7 +547,7 @@
     * 设置外放设备
     */
    private void routeAudioToSpeakerHelper(boolean speakerOn) {
        org.linphone.core.tools.Log.w("[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;
@@ -550,8 +556,14 @@
            if (currentCall == null) return;
            for (AudioDevice audioDevice : HDLLinphoneService.getCore().getAudioDevices()) {
                Log.d("HDLLinphoneKit","audioDevice.getType()= " + audioDevice.getType());
            }
            for (AudioDevice audioDevice : HDLLinphoneService.getCore().getAudioDevices()) {
                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");
                    return;
                } else if (!speakerOn && audioDevice.getType() == AudioDevice.Type.Earpiece) {
                    currentCall.setOutputAudioDevice(audioDevice);