4

I am developing a VoIP application using Pjsip in Objective-C.

I want to try and integrate CallKit but I got an error on configureAudioSession. I copied AudioController.h and AudioController.mm from SpeakerBox from Apple into my project.

And I added this code :

 AudioController *audioController;

 - (void)configureAudioSession {
      if (!audioController) {
         audioController = [[AudioController alloc] init];
      }
 }

- (void)handleIncomingCallFrom:(NSString *)dest {
    CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init];
    [callUpdate setLocalizedCallerName:dest];
    [callUpdate setHasVideo:NO];
    CXHandle *calleeHandle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:dest];
    [callUpdate setRemoteHandle:calleeHandle];
    [provider reportNewIncomingCallWithUUID:[NSUUID UUID] update:callUpdate completion:^(NSError *error){
        [self configureAudioSession];
    }];
}

Phone is ringing, I can handle the call but it crashes whenever I answer. I receive this error :

 AVAudioSession error activating: Error Domain=NSOSStatusErrorDomain Code=561017449 "(null)"
 2017-03-09 18:17:48.830893 MyVoIPProject[1620:971182] [aurioc] 892: failed: '!pri' (enable 3, outf< 1 ch,  16000 Hz, Int16> inf< 1 ch,  16000 Hz, Int16>)
 2017-03-09 18:17:48.841301 MyVoIPProject[1620:971182] [aurioc] 892: failed: '!pri' (enable 3, outf< 1 ch,  44100 Hz, Int16> inf< 1 ch,  44100 Hz, Int16>)
 2017-03-09 18:17:48.850282 MyVoIPProject[1620:971182] [aurioc] 892: failed: '!pri' (enable 3, outf< 1 ch,  48000 Hz, Int16> inf< 1 ch,  48000 Hz, Int16>)
 .
 .
 .
 .

Can you tell me how can I integrate Callkit?

NSNoob
  • 5,548
  • 6
  • 41
  • 54
  • 1
    Relevant: [this](http://stackoverflow.com/questions/25344403/how-do-i-get-my-sound-to-play-when-a-remote-notification-is-received) and [this](http://stackoverflow.com/questions/5083752/avaudiosession-endinterruption-returns-an-nsosstatuserrordomain) as far as error message is concerned – NSNoob Mar 10 '17 at 13:22
  • I will try. Thanks for answer and editing my question :). –  Mar 10 '17 at 13:25

1 Answers1

-3

This bug causes by you forget to add the Mircophone description in your Info.plist.

Reference: SpeakerBox from Apple iOS - AudioUnitInitialize returns error code 561017449

Community
  • 1
  • 1
Thien Chu
  • 90
  • 7