mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
fix lost of sons
This commit is contained in:
parent
e9b39b5423
commit
dd762b6714
3 changed files with 59 additions and 29 deletions
|
|
@ -372,6 +372,21 @@ import AVFoundation
|
|||
providerDelegate.endCall(uuid: uuid!)
|
||||
}
|
||||
}
|
||||
|
||||
@objc func setHeld(call: OpaquePointer, hold: Bool) {
|
||||
let sCall = Call.getSwiftObject(cObject: call)
|
||||
let callid = sCall.callLog?.callId ?? ""
|
||||
let uuid = providerDelegate.uuids["\(callid)"]
|
||||
|
||||
if (uuid == nil) {
|
||||
Log.directLog(BCTBX_LOG_ERROR, text: "Can not find correspondant call to group.")
|
||||
return
|
||||
}
|
||||
let setHeldAction = CXSetHeldCallAction(call: uuid!, onHold: hold)
|
||||
let transaction = CXTransaction(action: setHeldAction)
|
||||
|
||||
requestTransaction(transaction, action: "setHeld")
|
||||
}
|
||||
}
|
||||
|
||||
class CoreManagerDelegate: CoreDelegate {
|
||||
|
|
|
|||
|
|
@ -82,8 +82,12 @@
|
|||
switch (type) {
|
||||
case UIPauseButtonType_Call: {
|
||||
if (call != nil) {
|
||||
CallManager.instance.speakerBeforePause = CallManager.instance.speakerEnabled;
|
||||
linphone_call_pause(call);
|
||||
if ([CallManager callKitEnabled]) {
|
||||
[CallManager.instance setHeldWithCall:call hold:true];
|
||||
} else {
|
||||
CallManager.instance.speakerBeforePause = CallManager.instance.speakerEnabled;
|
||||
linphone_call_pause(call);
|
||||
}
|
||||
} else {
|
||||
LOGW(@"Cannot toggle pause buttton, because no current call");
|
||||
}
|
||||
|
|
@ -99,8 +103,12 @@
|
|||
case UIPauseButtonType_CurrentCall: {
|
||||
LinphoneCall *currentCall = [UIPauseButton getCall];
|
||||
if (currentCall != nil) {
|
||||
CallManager.instance.speakerBeforePause = CallManager.instance.speakerEnabled;
|
||||
linphone_call_pause(currentCall);
|
||||
if ([CallManager callKitEnabled]) {
|
||||
[CallManager.instance setHeldWithCall:currentCall hold:true];
|
||||
} else {
|
||||
CallManager.instance.speakerBeforePause = CallManager.instance.speakerEnabled;
|
||||
linphone_call_pause(currentCall);
|
||||
}
|
||||
} else {
|
||||
LOGW(@"Cannot toggle pause buttton, because no current call");
|
||||
}
|
||||
|
|
@ -113,7 +121,11 @@
|
|||
switch (type) {
|
||||
case UIPauseButtonType_Call: {
|
||||
if (call != nil) {
|
||||
linphone_call_resume(call);
|
||||
if ([CallManager callKitEnabled]) {
|
||||
[CallManager.instance setHeldWithCall:call hold:false];
|
||||
} else {
|
||||
linphone_call_resume(call);
|
||||
}
|
||||
} else {
|
||||
LOGW(@"Cannot toggle pause buttton, because no current call");
|
||||
}
|
||||
|
|
@ -127,7 +139,11 @@
|
|||
}
|
||||
case UIPauseButtonType_CurrentCall: {
|
||||
LinphoneCall *currentCall = [UIPauseButton getCall];
|
||||
linphone_call_resume(currentCall);
|
||||
if ([CallManager callKitEnabled]) {
|
||||
[CallManager.instance setHeldWithCall:currentCall hold:false];
|
||||
} else {
|
||||
linphone_call_resume(currentCall);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,34 +185,33 @@ extension ProviderDelegate: CXProviderDelegate {
|
|||
if (call == nil) {
|
||||
return
|
||||
}
|
||||
if (UIApplication.shared.applicationState != .active) {
|
||||
do {
|
||||
if (CallManager.instance().lc?.isInConference ?? false && action.isOnHold) {
|
||||
try CallManager.instance().lc?.leaveConference()
|
||||
Log.directLog(BCTBX_LOG_DEBUG, text: "CallKit: Leaving conference")
|
||||
NotificationCenter.default.post(name: Notification.Name("LinphoneCallUpdate"), object: self)
|
||||
|
||||
do {
|
||||
if (CallManager.instance().lc?.isInConference ?? false && action.isOnHold) {
|
||||
try CallManager.instance().lc?.leaveConference()
|
||||
Log.directLog(BCTBX_LOG_DEBUG, text: "CallKit: Leaving conference")
|
||||
NotificationCenter.default.post(name: Notification.Name("LinphoneCallUpdate"), object: self)
|
||||
return
|
||||
}
|
||||
|
||||
let state = action.isOnHold ? "Paused" : "Resumed"
|
||||
Log.directLog(BCTBX_LOG_DEBUG, text: "CallKit: Call with call-id: [\(String(describing: callId))] and UUID: [\(uuid)] paused status changed to: [\(state)]")
|
||||
if (action.isOnHold) {
|
||||
if (call!.params?.localConferenceMode ?? false) {
|
||||
return
|
||||
}
|
||||
|
||||
let state = action.isOnHold ? "Paused" : "Resumed"
|
||||
Log.directLog(BCTBX_LOG_DEBUG, text: "CallKit: Call with call-id: [\(String(describing: callId))] and UUID: [\(uuid)] paused status changed to: [\(state)]")
|
||||
if (action.isOnHold) {
|
||||
if (call!.params?.localConferenceMode ?? false) {
|
||||
return
|
||||
}
|
||||
CallManager.instance().speakerBeforePause = CallManager.instance().speakerEnabled
|
||||
try call!.pause()
|
||||
CallManager.instance().speakerBeforePause = CallManager.instance().speakerEnabled
|
||||
try call!.pause()
|
||||
} else {
|
||||
if (CallManager.instance().lc?.conference != nil && CallManager.instance().lc?.callsNb ?? 0 > 1) {
|
||||
try CallManager.instance().lc?.enterConference()
|
||||
NotificationCenter.default.post(name: Notification.Name("LinphoneCallUpdate"), object: self)
|
||||
} else {
|
||||
if (CallManager.instance().lc?.conference != nil && CallManager.instance().lc?.callsNb ?? 0 > 1) {
|
||||
try CallManager.instance().lc?.enterConference()
|
||||
NotificationCenter.default.post(name: Notification.Name("LinphoneCallUpdate"), object: self)
|
||||
} else {
|
||||
try call!.resume()
|
||||
}
|
||||
try call!.resume()
|
||||
}
|
||||
} catch {
|
||||
Log.directLog(BCTBX_LOG_ERROR, text: "CallKit: Call set held (paused or resumed) \(uuid) failed because \(error)")
|
||||
}
|
||||
} catch {
|
||||
Log.directLog(BCTBX_LOG_ERROR, text: "CallKit: Call set held (paused or resumed) \(uuid) failed because \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue