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