Swift CXCallUpdate not working for outgoing calls

2 days ago 1
ARTICLE AD BOX

I start an outgoing call using below code.

let handle = CXHandle(type: .generic, value: handleValue) let startCallAction = CXStartCallAction(call: uuid, handle: handle) let transaction = CXTransaction(action: startCallAction) self.pendingCallData[uuid] = conference callKitCallController.request(transaction) { error in if let error = error { print("StartCallAction transaction request failed: \(error.localizedDescription)") } else { print("StartCallAction transaction request successful") } }

Initially, I set the callee’s phone number as the value of the CXHandle when starting an outgoing call.

After the call is initiated, the user can add more participants (i.e., it becomes a group call). At that point, I need to update the remoteHandle to store a call ID instead of the original phone number. This is required so that when the user taps the call from the device’s recent call log, I can retrieve the call ID and re-initiate the group call.

However, updating the remoteHandle does not seem to work for outgoing calls, it always retains the initial value (the phone number). Interestingly, this works as expected for incoming calls.

Below is the code I’m using to update the handle:

let update = CXCallUpdate() update.remoteHandle = CXHandle(type: .generic, value: conference.id) SharedCallKitProvider.shared.reportCall(with: callUUID, updated: update) @MainActor enum SharedCallKitProvider { private static var _provider: CXProvider? static var shared: CXProvider { if let existing = _provider { return existing } let config = CXProviderConfiguration() config.supportsVideo = false config.maximumCallGroups = 1 config.maximumCallsPerCallGroup = 1 config.iconTemplateImageData = UIImage(named: "truck")?.pngData() config.supportedHandleTypes = [.generic,.phoneNumber] let provider = CXProvider(configuration: config) _provider = provider return provider } }
Read Entire Article