CallKit invokes CXEndCallAction after starting the call, resulting in hangup on Simulator

I am using Xcode Version 15.3 (15E204a) and different versions of Simulator runtimes (17.x, 16.x, 15.0)

The app makes outgoing calls and can respond to incoming calls. After starting the call, ~2s pass before a hangup occurs. In the Console logs I see that CXEndCallAction was invoked by CallKit and the last suspicious log before invoking the CXEndCallAction is

callservicesd	Disconnecting call because there wont be a UI to host the call: <CSDProviderCall 0x107054300 type=PhoneNumber, value=sdsddsdds, stat=Sending tStat=0, model=<TUCallModel 0x103f661e0 hold=1 grp=1 ungrp=1> ... 

This used to work before, but since upgrading to Xcode 15 and iOS 17.x it happens constantly on simulator versions 17.x, and sometimes on 16.x, whereas I wasn't able to reproduce it on 15.0 version.

Can someone help me understand why this happens and how to fix it? I provided some logs down below, and I don't see similar logs in the cases when the call is okay and CallKit doesn't hangup it.

Also, this does not happen on real devices

From the time CXStartCallAction is invoked until the CallKit invokes CXEndCallAction, these are some of the error or warn logs that appear:

callservicesd	-AVSystemController- +[AVSystemController sharedInstance]: Failed to allocate AVSystemController, numberOfAttempts=3

callservicesd	[WARN] +[AVSystemController sharedAVSystemController] returned nil value
callservicesd	[WARN] Not allowing requested start call action because a call with same UUID already exists callWithUUID: (omitted)
callservicesd	Error while determining process action for callSource: (omitted)
callservicesd	Determined that callSource: <CXXPCCallSource 0x103d060a0, ...>, should process action: <CXStartCallAction 0x107232760 UUID=8D34853F-55DD-4DEC-97A7-551BFD27C924, error: Error Domain=com.apple.CallKit.error.requesttransaction Code=5 "(null)"
callservicesd	[0x103e417a0] invalidated after the last release of the connection object
callservicesd	[WARN] No paired device, so unable to send message UpdateCallContext
callservicesd	FaceTime caller ID (null) is not a valid outgoing relay caller ID
callservicesd	Attempting to find a valid outgoing caller ID in set of available outgoing caller IDs {(
)}
callservicesd	Could not automatically select an outgoing caller ID; multiple telephone numbers are listed in the set of available outgoing caller IDs {(
)}
callservicesd	Adding call <CSDProviderCall 0x107054300 ...> to dirty calls pool
callservicesd	Entitlement check: ... entitlementCapabilities={(
    "access-call-providers",
    "modify-calls",
    "access-call-capabilities",
    "access-calls"
)}> lacks capability 'access-screen-calls'
callservicesd	[WARN] ... but no dynamic identifier could be found (1) or no handoff user info exists (1). Not broadcasting frontmost call
error com.apple.CallKit.CallDirectoryUnable to initialize CXCallDirectoryStore for reading: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “CallDirectory” in the folder “Library”." ... {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}

The logs provided are in order in which they are logged, but some of them are recurring After these logs there is still a message that CXStartCallAction is fullfilled:

callservicesd	Start call action fulfilled: <CXStartCallAction 0x107231fe0 UUID=8D34853F-55DD-4DEC-97A7-551BFD27C924 ...>

After which the last suspicious log is logged before CXEndCallAction is invoked by CallKit:

Disconnecting call because there wont be a UI to host the call: <CSDProviderCall 0x107054300 ...>
CallKit invokes CXEndCallAction after starting the call, resulting in hangup on Simulator
 
 
Q