Reputation: 21
I need to accept the call by tapping custom UI button.
From native push call screen system is notified by CXProviderDelegate
method
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction)
But how to notify CallKit with custom UI?
E.g. I can notify CallKit about ended call by method
reportCall(with UUID: UUID, endedAt dateEnded: Date?, reason endedReason: CXCallEndedReason)
Upvotes: 0
Views: 1192
Reputation: 5347
If you still need to know how to manually notify the action from a custom UI, below you can find the solution.
In any case, let have it here for future references.
let answerAction: CXAnswerCallAction = CXAnswerCallAction(call: incomingCallUUID)
let transaction: CXTransaction = CXTransaction(action: answerAction)
callController.request(transaction) { error in
if let error = error {
NSLog("Error!!!")
} else {
NSLog("Success")
}
}
note: callController type is CXCallController
, and incomingCallUUID is the incoming call UUID reported by your CXProvider at reportNewIncomingCall(with:)
Upvotes: 3