forked from mirrors/linphone-iphone
end call if it does nit exist
This commit is contained in:
parent
d2a5913d09
commit
080907dc82
1 changed files with 13 additions and 9 deletions
|
|
@ -104,15 +104,6 @@ class ProviderDelegate: NSObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func reportForkIncomingCall() {
|
||||
let uuid = UUID()
|
||||
let update = CXCallUpdate()
|
||||
update.remoteHandle = CXHandle(type:.generic, value: "Unknow")
|
||||
|
||||
provider.reportNewIncomingCall(with: uuid, update: update, completion: {_ in})
|
||||
provider.reportCall(with: uuid, endedAt: .init(), reason: .failed)
|
||||
}
|
||||
|
||||
func updateCall(uuid: UUID, handle: String, hasVideo: Bool = false) {
|
||||
let update = CXCallUpdate()
|
||||
|
|
@ -128,6 +119,10 @@ class ProviderDelegate: NSObject {
|
|||
func reportOutgoingCallConnected(uuid:UUID) {
|
||||
provider.reportOutgoingCall(with: uuid, connectedAt: nil)
|
||||
}
|
||||
|
||||
func endCallForError(uuid: UUID, endedAt: Date?, endedReason: CXCallEndedReason) {
|
||||
provider.reportCall(with: uuid, endedAt: endedAt, reason: endedReason)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - CXProviderDelegate
|
||||
|
|
@ -162,6 +157,15 @@ 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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue