CallKit issue with call holding (iOS 10)

Hello,


I have an issue with CallKit API on iOS 10.3.3 and lower iOS versions.

My configuration supports call holding and grouping, here is the snippet:


let configuration = CXProviderConfiguration(localizedName: applicationName)
configuration.supportsVideo = supportsVideo
configuration.supportedHandleTypes = [.phoneNumber]
configuration.maximumCallGroups = 2
configuration.maximumCallsPerCallGroup = 3


On iOS 10, CallKit drops the call when app requests setHeld action for call. Here is the snippet of setHeld call action request:


public func performSetCallOnHoldAction(_ call: Call, isOnHold: Bool) {
let setHeldAction = CXSetHeldCallAction(call: UUID(uuidString: call.callUUID)!, onHold: isOnHold)
let transaction = CXTransaction()
transaction.addAction(setHeldAction)
requestTransaction(transaction)
}


And finally, here is the CXProvider delegate method, which completes the hold/unhold action for call:


func provider(_ provider: CXProvider, perform action: CXSetHeldCallAction) {
// Retrieve the Call instance corresponding to the action's call UUID
guard let call = CallList.sharedInstance().call(withUUID: action.callUUID.uuidString) else {
action.fail()
return
}
// Perform PJSUA set held action
if action.isOnHold {
Pjsua2Wrapper.sharedInstance()?.holdCall(withCallUUID: call.callUUID, completion: { (error) in
(error != nil) ? action.fail() : action.fulfill()
})
} else {
Pjsua2Wrapper.sharedInstance()?.unholdCall(withCallUUID: call.callUUID, completion: { (error) in
(error != nil) ? action.fail() : action.fulfill()
})
}
}


Note that I use Pjsip to perform a hold/unhold action and inside a completion block I call

action.fulfill(
) or
action.fail()
, depending wether psjip returns the error.


In application GUI, there is a toggle swap button, which calls function to perform

CXSetHeldCallAction
on
CXCallController
.

On iOS 11.0 everything works perfectly, but on iOS 10, when you press that toggle button, the call which is supposed to be set on hold, gets ended by the

CXProvider
for some reason (
CXProvider
responds with
CXEndCallAction
).


I have looked in debugger for

requestTransaction
method wether it returns transaction error, but there is no error in requesting a transaction to call controller.


Does anyone have an idea what is wrong, or something that I can try out to fix this issue?


Please help,


with Best regards,


Miljan

Having same issue on iOS14.
I did not check on ios 10 but on iOS 12-13 this issue was not present and on iOS 14 it did appear. Is it an iOS bug or an expected behaviour? if it is expected how can it be fixed?
i have discovered that it depends on order of hold/unhold. If you need to swap calls you need first to put one on hold(CXSetHeldCallAction isOnHold=1) and then unhold another(CXSetHeldCallAction isOnHold=0). For me it did solve the issue.
I think its expected, seeing the same in iOS 14- if in any case that 2 calls is in unhold state at the same time then one of them will be killed, I normally have to make sure all the calls on hold first and then unhold one of them
CallKit issue with call holding (iOS 10)
 
 
Q