I am working on audio/video call implementation and it is working fine. So now I am working on scenario when my voip calls gets interrupted by gsm call. When I receive any gsm call I get End/Answer and Hold/accept option in callkit.
When I select Hold/accept option my calls gets hold by calling CXSetHeldCallAction method and I paused/muted my video/audio and at the same time iOS deactivate audio session by calling didDeactivate audioSession method which is expected behaviour.
Now if I end the gsm call from my end by tapping end call button from callkit my audio session gets activated automatically and also I resume my video and audio. But the same is not happening if another user ends the call and no audio session gets activated and so audio is not working in this case.
I check different stack overflow answers and tried everything possible but still couldn't able to figure out the solution. I even tried to activated the session manually but got session activation failed error. So if anyone have faced the same issue and solved the issue please give me an idea how can I do that.
After hours of debugging I resolved the issue. I implemented a
CXCallObserverdelegatecallChanged, where I checked if another call gets ended or not with the help of my voip call id. If another call gets ended, I callCXSetHeldCallActionto unhold my voip call and, in this way, the audio session got restored automatically.