From a7e4a28426eff469c5177577b80e37b65ad8ea9c Mon Sep 17 00:00:00 2001 From: Ali <> Date: Mon, 13 Mar 2023 16:38:39 +0400 Subject: [PATCH] If there is no call session, return terminated state --- .../TelegramCore/Sources/State/CallSessionManager.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/submodules/TelegramCore/Sources/State/CallSessionManager.swift b/submodules/TelegramCore/Sources/State/CallSessionManager.swift index f7a4524c28..6251ed0950 100644 --- a/submodules/TelegramCore/Sources/State/CallSessionManager.swift +++ b/submodules/TelegramCore/Sources/State/CallSessionManager.swift @@ -458,6 +458,9 @@ private final class CallSessionManagerContext { } } }) + } else { + subscriber.putNext(CallSession(id: internalId, stableId: nil, isOutgoing: false, type: .audio, state: .terminated(id: nil, reason: .error(.generic), options: []), isVideoPossible: true)) + subscriber.putCompletion() } } return disposable @@ -536,7 +539,10 @@ private final class CallSessionManagerContext { let context = CallSessionContext(peerId: peerId, isOutgoing: false, type: isVideo ? .video : .audio, isVideoPossible: isVideoPossible, state: .ringing(id: stableId, accessHash: accessHash, gAHash: gAHash, b: b, versions: versions)) self.contexts[internalId] = context let queue = self.queue - context.acknowledgeIncomingCallDisposable.set(self.network.request(Api.functions.phone.receivedCall(peer: .inputPhoneCall(id: stableId, accessHash: accessHash))).start(error: { [weak self] _ in + + let requestSignal: Signal = self.network.request(Api.functions.phone.receivedCall(peer: .inputPhoneCall(id: stableId, accessHash: accessHash))) + + context.acknowledgeIncomingCallDisposable.set(requestSignal.start(error: { [weak self] _ in queue.async { guard let strongSelf = self else { return