From 7960485054f37eb60d63a98231686cef41302a8b Mon Sep 17 00:00:00 2001 From: chenqiyang <1406175257@qq.com> Date: 星期三, 11 五月 2022 09:13:56 +0800 Subject: [PATCH] 修改部分方法 --- HDLLinPhoneSDK/HDLLinPhoneSDK/HDLCallManager.swift | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-) diff --git a/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLCallManager.swift b/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLCallManager.swift index 9f7643b..72f124c 100644 --- a/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLCallManager.swift +++ b/HDLLinPhoneSDK/HDLLinPhoneSDK/HDLCallManager.swift @@ -176,9 +176,9 @@ providerDelegate.callInfos.updateValue(callInfo, forKey: uuid) providerDelegate.uuids.updateValue(uuid, forKey: callId) let state: UIApplication.State = UIApplication.shared.applicationState - if state == .background{ - providerDelegate.reportIncomingCall(call:call, uuid: uuid, handle: handle, hasVideo: hasVideo) - } +// if state == .background{ +// providerDelegate.reportIncomingCall(call:call, uuid: uuid, handle: handle, hasVideo: hasVideo) +// } // providerDelegate.reportIncomingCall(call:call, uuid: uuid, handle: handle, hasVideo: hasVideo) } @@ -202,6 +202,7 @@ } let call = Call.getSwiftObject(cObject: call!) acceptCall(call: call, hasVideo: hasVideo) +// HDLCallManager.instance().lc?.activateAudioSession(actived: true) } @@ -239,6 +240,9 @@ let sAddr = Address.getSwiftObject(cObject: addr!) if (HDLCallManager.callKitEnabled() && !HDLCallManager.instance().nextCallIsTransfer) { + print("callKitEnabled") +// HDLCallManager.configAudioSession(audioSession: AVAudioSession.sharedInstance()) + let uuid = UUID() let name = "unknow" let handle = CXHandle(type: .generic, value: name) @@ -251,6 +255,7 @@ requestTransaction(transaction, action: "startCall") }else { + print("doCall") try? doCall(addr: sAddr, isSas: isSas) } } @@ -285,6 +290,7 @@ lcallParams.mediaEncryption = .ZRTP } lcallParams.videoEnabled=true; + let call = HDLCallManager.instance().lc!.inviteAddressWithParams(addr: addr, params: lcallParams) if (call != nil) { // The LinphoneCallAppData object should be set on call creation with callback @@ -337,7 +343,7 @@ } // To be removed. - static func configAudioSession(audioSession: AVAudioSession) { + @objc static func configAudioSession(audioSession: AVAudioSession) { do { try audioSession.setCategory(AVAudioSession.Category.playAndRecord, mode: AVAudioSession.Mode.voiceChat, options: AVAudioSession.CategoryOptions(rawValue: AVAudioSession.CategoryOptions.allowBluetooth.rawValue | AVAudioSession.CategoryOptions.allowBluetoothA2DP.rawValue)) try audioSession.setMode(AVAudioSession.Mode.voiceChat) @@ -360,6 +366,20 @@ } catch { } +// LinphoneCall *currentcall = linphone_core_get_current_call(LC); +// if (linphone_core_is_in_conference(LC) || // In conference +// (linphone_core_get_conference_size(LC) > 0 && [UIHangUpButton callCount] == 0) // Only one conf +// ) { +// LinphoneManager.instance.conf = TRUE; +// linphone_core_terminate_conference(LC); +// } else if (currentcall != NULL) { +// linphone_call_terminate(currentcall); +// } else { +// const MSList *calls = linphone_core_get_calls(LC); +// if (bctbx_list_size(calls) == 1) { // Only one call +// linphone_call_terminate((LinphoneCall *)(calls->data)); +// } +// } if (UIApplication.shared.applicationState == .background) { HDLCoreManager.instance().stopLinphoneCore() } -- Gitblit v1.8.0