The question is getting from here and seem no one give a proper answer yet.
==================================
Hi Devs,
I'm developing a Social networking app which includes audio call feature. I integrated with SocketIO + WebRTC for this audio call. I'm receiving audio call by two ways. Socket call when socket is connected & active VoIP call by default irrespective of socket is connected or not.
FYI, Why i had two ways of receiving call as mentioned above,
- Enabled VoIP by default, because sometimes socket call is unresponsive and never show call at that time.
- Enabled socket when app is in foreground, to ensure that call is received in case of MissingDeviceToken/BadDeviceToken errors occurred for VoIP push.
Considering iOS 13 guidelines for VoIP usage, I followed below steps for integration.
When app is killed or socket not connected, will get VoIP call and responding with provider.reportNewIncomingCall(). So here no issue for VoIP usage.
When socket is connected, will get both socket call & VoIP call. But socket call will get instantly before getting VoIP call. So here's what i did:
- Responded socket call with
provider.reportNewIncomingCall(). - After a little delay will get VoIP push for the same call which is already invoked by socket. Here, I should respond this VoIP push with CallKit. But i have already invoked the call. So, I used below code to handle.
- Responded socket call with
provider.reportCall(with: call.uuid, updated: update) with same uuid & update used for socket call initiation.
Hope, this VoIP call also responded with CallKit and there's no issue in VoIP blocking/app termination.
Question 1 : Is this a proper way of handling above issue ?
===========================================================================================================
As per my app requirement, there's should be one active call at a time from my app.
Consider, I'm in active call and one more incoming call is received via VoIP. So here, I don't want to show the additional call. So I'm ignoring the VoIP push for the additional call. But it leads to this crash "Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push callback."
Question 2 : How to handle above mentioned scenario ?
===========================================================================================================
What I try
For question 2, I try answer from this one.
Though it does not work in some case for example when user happen to answer a call fast enough, the second incoming call from push will result in Call Stacking screen.
This approach also create additional call in recent call list and a bar incoming call saying call ended during incoming screen for the first incoming event which is bad user experience.
I also found this one to look promising but it is very had known this will be fine.
Does anyone have any solution to this? Thanks