end incoming call if it does not exist again

This commit is contained in:
Danmei Chen 2020-04-02 21:26:03 +02:00
parent 89598d2497
commit 6b8c96348d

View file

@ -103,6 +103,15 @@ class ProviderDelegate: NSObject {
}
}
}
DispatchQueue.main.asyncAfter(deadline: .now() + 30) {// in 30 second
if (CallManager.instance().lc?.callsNb == 0 && !CallManager.instance().providerDelegate.callInfos.isEmpty ) {
Log.directLog(BCTBX_LOG_MESSAGE, text: "CallKit: end call which does not exist.")
for suuid in CallManager.instance().providerDelegate.uuids.values {
CallManager.instance().providerDelegate.endCallForError(uuid: suuid, endedAt: .init(), endedReason: .declinedElsewhere)
}
}
}
}
func updateCall(uuid: UUID, handle: String, hasVideo: Bool = false) {
@ -157,15 +166,6 @@ extension ProviderDelegate: CXProviderDelegate {
CallManager.configAudioSession(audioSession: AVAudioSession.sharedInstance())
callInfo?.accepted = true
callInfos.updateValue(callInfo!, forKey: uuid)
DispatchQueue.main.asyncAfter(deadline: .now() + 30) {// in 30 second
if (CallManager.instance().lc?.callsNb == 0 && !CallManager.instance().providerDelegate.callInfos.isEmpty ) {
Log.directLog(BCTBX_LOG_MESSAGE, text: "CallKit: end call which does not exist.")
for suuid in CallManager.instance().providerDelegate.uuids.values {
CallManager.instance().providerDelegate.endCallForError(uuid: suuid, endedAt: .init(), endedReason: .declinedElsewhere)
}
}
}
} else {
CallManager.instance().acceptCall(call: call!, hasVideo: call!.params?.videoEnabled ?? false)
}