func startOutgoingCall(of session: String) is not used. Why?
The following method is useless:
func setCallConnected(of session: String) {
let uuid = pairedUUID(of: session)
if let call = currentCall(of: uuid), call.isOutgoing, !call.hasConnected, !call.hasEnded {
provider.reportOutgoingCall(with: uuid, connectedAt: nil)
}
}
it's called from func callCenter(_ callCenter: CallCenter, answerCall session: String) method which is called on remote side (when incoming call is accepted).
I can conclude that both sides - caller and callee are incorrectly using CallKit.
I don't see provider?.reportOutgoingCall(with UUID: UUID, startedConnectingAt dateStartedConnecting: Date?) calls in the code. It should be done before provider.reportOutgoingCall(with: uuid, connectedAt: nil) call and after startOutgoingCall() on caller side.
=======
for 1. you should move all code from func callingVC(_ vc:CallingViewController, startOutgoing numbers: String?) { to
and put startOutgoingCall(..) call into func callingVC(_ vc:CallingViewController, startOutgoing numbers: String?) {.
for 2. If provider.reportOutgoingCall(with: uuid, connectedAt: nil) is not called, then CallKit will treat the outgoing call as failed after sometime, and it will not be registered in the system. You should call it in caller when connection is established.
To fix this, you need to send a message from callee to caller in
or in accepted callback in inviter.sendInvitation(peer: remoteNumber, extraContent: channel, accepted: {...}, ...)
======
PS. The main problem is that the app seems to work fine. But CallKit is completely unaware of what's going on (on both sides). For example, in case of incoming phone call during outgoing "agora video call", iOS will just show incoming phone call and it will not take into account that there is another (outgoing video) call.
func startOutgoingCall(of session: String)
is not used. Why?The following method is useless:
it's called from
func callCenter(_ callCenter: CallCenter, answerCall session: String)
method which is called on remote side (when incoming call is accepted).I can conclude that both sides - caller and callee are incorrectly using CallKit.
provider?.reportOutgoingCall(with UUID: UUID, startedConnectingAt dateStartedConnecting: Date?)
calls in the code. It should be done beforeprovider.reportOutgoingCall(with: uuid, connectedAt: nil)
call and afterstartOutgoingCall()
on caller side.======= for 1. you should move all code from
func callingVC(_ vc:CallingViewController, startOutgoing numbers: String?) {
toand put
startOutgoingCall(..)
call intofunc callingVC(_ vc:CallingViewController, startOutgoing numbers: String?) {
.for 2. If
provider.reportOutgoingCall(with: uuid, connectedAt: nil)
is not called, then CallKit will treat the outgoing call as failed after sometime, and it will not be registered in the system. You should call it in caller when connection is established.To fix this, you need to send a message from callee to caller in
(it's done already:
inviter.accpetLastIncomingInvitation()
) and callsetCallConnected()
on caller side inor in
accepted
callback ininviter.sendInvitation(peer: remoteNumber, extraContent: channel, accepted: {...}, ...)
====== PS. The main problem is that the app seems to work fine. But CallKit is completely unaware of what's going on (on both sides). For example, in case of incoming phone call during outgoing "agora video call", iOS will just show incoming phone call and it will not take into account that there is another (outgoing video) call.