Prevent CallKit timeout when placing outgoing call

More fallout from the outbound call timeout which was causing all
CallKit calls not promptly answered to show "Call Failed"

Inserting the timeout exacerbated an existing issue: We can't wait for
long before choosing to fulfill/fail an action without CallKit falling
over and assuming the call failed.

We don't actually need to consider the case where we "fail to initiate"
the outgoing call. Instead we say it started "successfully, and if there
is an error, the existing promise error handling will fail the call at
that time.

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 6cdf13ea5f
commit 3ab65a2c88

@ -228,14 +228,12 @@ final class CallKitCallUIAdaptee: NSObject, CallUIAdaptee, CXProviderDelegate {
return
}
self.callService.handleOutgoingCall(call).then { () -> Void in
action.fulfill()
self.provider.reportOutgoingCall(with: call.localId, startedConnectingAt: nil)
}.catch { error in
Logger.error("\(self.TAG) error \(error) in \(#function)")
self.callManager.removeCall(call)
action.fail()
}
// We can't wait for long before fulfilling the CXAction, else CallKit will show a "Failed Call". We don't
// actually need to wait for the outcome of the handleOutgoingCall promise, because it handles any errors by
// manually failing the call.
_ = self.callService.handleOutgoingCall(call)
action.fulfill()
self.provider.reportOutgoingCall(with: call.localId, startedConnectingAt: nil)
}
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {

Loading…
Cancel
Save