Everything works fine if we launch the app in the foreground. But there is an issue when the app is previously killed and is restarted by receiving a PushKit notification on the lock screen.
When the app receives a PushKit notification we display the CallKit UI. This works correctly. The user is able to answer the call and establish a connection via WebRTC. But there is no audio at all.
The strange thing is that if the user opens the app from CallKit screen by tapping on the application icon, the audio starts and works as expected. So it looks like the problem is with the audio session configuration. Maybe for some reason, iOS doesn't allow our audio session to be activated.
We're using Google's WebRTC library:
pod 'GoogleWebRTC', '1.1.26115'
We tried different approaches:
Enabling/disabling audio background mode.
Configuring audio session before and after the
didActivate
callback is received from CallKit delegate.Configuring audio session manually and using
RTCAudioSession.sharedInstance
from WebRTC library.Enabling and disabling
RTCAudioSession.useManualAudio
.
This is the scenario where we encounter the issue:
Kill the app. Lock the phone.
Call this user from another phone.
PushKit launches the app, the app presents CallKit screen, the user answers the call.
The connection establishes correctly. The call is active but there is no sound on both ends.
Tap on the app icon (most bottom right) on the CallKit screen and unlock the phone. The audio starts.
Any help is appreciated.