I have a VOIP App with Sinch Video integration. If the App is running from the background there is a window of about 1 - 3 seconds where the VOIP Push gets send through but the Sinch Call is not yet connected. (iOS13 requirement of reporting VOIP Push immediately).
In Apple's documentation they give this Hint:
Responding to VoIP Notifications from PushKit
If the recipient of a call answers before the app establishes a connection to your server, don't fulfill the CXAnswerCallAction object sent to the provider:performAnswerCallAction: method of your delegate immediately. Instead, wait until you establish a connection and then fulfill the object. While it waits for your app to fulfill the request, the incoming call interface lets the user know that the call is connecting, but not yet ready.
This behavior can be observed by Facetime as well, were often for a short period of time CallKit shows connecting...
I can not by the life of it figure out how to properly follow this advice by Apples documentation.
Is there any way I can per standard let the AnswerCallAction always delay the answering process by let's say 2 seconds?
here is my relevant provider delegate method:
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
if (!(CommunicationService.shared?.tellGuardAnswerCallAction())!){
action.fail()
print("CXCallDelegate CXProvider: ERROR Answering Call")
return
}
self.callManager.removeAll()
CommunicationService.shared?.cDotAnswer()
action.fulfill()
}
If I answer the call before the Sinch Call and the UIKit Call are connected then the Call will not work. So ideally I would always give the code about 1 - 2 seconds time to connect OR check if the Sinch Call is connected before proceeding to action.fulfill()
I have faced the same issue. This issue occurs only when the App is in background and the device is in Locked State.
The fix is easy. Once the New Incoming Call is reported by Call Kit, You need to fullfill the answer action in performAnswerCallAction method.
Apple suggests us to wait till the connection gets established before fulfilling the PerformAnswerAction.