I am working on a CallKit enabled VOIP application and sometimes our clients are facing a problem that the didActivateAudioSession callback is never called by the iOS system.
Is there a known bug as this or do you think that we have something missing like setting the correct mode of the AVAudioSession or something like that?
This is how I prepare AVAudioSession before reporting call to the system by CallKit;
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:nil];
[audioSession setActive:YES error:nil];
My problem is not activating the audio session (I have a special check related with the previous call's audio session deactivation) because I cannot deactivate the audio session for some calls.
When the other side rejects my call, I play a busy tone sound and after the sound I try to deactivate the audio session with audioPlayerDidFinishPlaying callback.
The problem is that I set the AVAudioPlayer delegate in a wrong place, I have to set it before playing the busy tone not after initializing it.
Thanks for the post in https://stackoverflow.com/a/5697900/1351327 solved my problem.
This is the answer of my problem but the valuable post is the RJV Kumar's one.