// The system's call UI on a simulator: none. CallKit hangs up an outgoing call// on a simulator about a second after starting it (it cannot open its in-call// screen there: "Failed to open URL facetime://?showInCallUI=1"), and the// session is then never activated, so a call placed or joined from a// simulator could not stay up (seen walking a group call on dev, launch-ios,// 23 Nov 2026). Here a call starts, connects and ends in the app alone, the// audio session activated by this port as CallKit would. A simulator gets no// VoIP push, so it is never rung; a real iPhone always has CallKit.#if os(iOS) && targetEnvironment(simulator)import AVFoundationimportFoundation@MainActorpublicfinalclassSimulatorCallSystem: SystemCallPort {/// Where the session's activation goes: set once the center is made.publicweakvar center: CallCenter?privatevar live: Set<UUID> = []privatelet log: @Sendable (String) -> Voidpublicinit(log: @escaping @Sendable (String) -> Void = { _ in }) {self.log = log }publicfunc startOutgoing(uuid: UUID, handle: String, name: String?, video: Bool) { live.insert(uuid) activate() }publicfunc outgoingConnecting(uuid: UUID) {}publicfunc outgoingConnected(uuid: UUID) {}publicfunc reportIncoming(uuid: UUID, title: String, handle: String?, video: Bool) {// Answered from the app's own screen: the session is the app's to start. live.insert(uuid) activate() }publicfunc update(uuid: UUID, handle: String, name: String?, video: Bool) {}publicfunc ended(uuid: UUID, reason: Int?) {guard live.remove(uuid) != nil, live.isEmpty else { return } center?.audioDeactivated()do {try AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation) } catch { log("simulator call: the session would not stop: \(error)") } }privatefunc activate() {do {try AVAudioSession.sharedInstance().setActive(true) center?.audioActivated() } catch { log("simulator call: the session would not start: \(error)") } }}#endif