| | |
| | | @Override |
| | | public void incomingCall(Call linphoneCall) { |
| | | super.incomingCall(linphoneCall); |
| | | Log.d("HDLLinphoneKit","------incomingCall------"); |
| | | if (linphoneCall != null) { |
| | | String callUsername = linphoneCall.getRemoteAddress().getUsername(); |
| | | HDLLog.I("来电号码:" + callUsername); |
| | |
| | | @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)); |
| | | |
| | | } |
| | |
| | | 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(); |
| | | } |
| | |
| | | * 设置外放设备 |
| | | */ |
| | | 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; |
| | |
| | | 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); |