I am integrating the new CallKit API with my VOIP application.
As shown in the sample application: https://developer.apple.com/library/content/samplecode/Speakerbox/Introduction/Intro.html
I am setting up an audio session:
- (void) configureAudioSession { // Configure the audio session AVAudioSession *sessionInstance = [AVAudioSession sharedInstance]; // we are going to play and record so we pick that category NSError *error = nil; [sessionInstance setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]; if (error) { NSLog(@"error setting audio category %@",error); } // set the mode to voice chat [sessionInstance setMode:AVAudioSessionModeVoiceChat error:&error]; if (error) { NSLog(@"error setting audio mode %@",error); } NSLog(@"setupAudioSession"); return; }
in my CXAnswerCallAction:
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) { print("Provider - CXAnswerCallAction")
According to the documentation, didActivate should be called by callkit:
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) { print("Provider - Received \(#function)")
For some reason, it does not call back after the first VOIP call. Subsequent calls seem to receive a callback, and they work just fine.
How to fix it?
source share