Search code examples
objective-creact-nativeios18portsipreact-native-call-keep

One way Audio issues in iOS 18.2 on call apps


I have a mobile app that uses for taking voice calls between two parties via VoIP protocol. That was worked until iOS 16 and now it is giving one way audio issues. That means when I try to take a call to another user, sometimes that user cannot hear my voice. This is sporadic and it activates the audio when I toggle the speaker button. So I am using PortSIP (licensed) SDK for SIP connections and RNCallKeep library to handle CallKit operations. I have tried activating audio using AVAudioSession's [audioSession setActive:YES error:nil] but no any improvements either. Also tried to set Configurations manually to

  BOOL success = [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord
                                        mode:AVAudioSessionModeVoiceChat
                                     options:AVAudioSessionCategoryOptionAllowBluetooth
                                       error:&error];

But still I have the issues.

Then I tried to set configs to the RNCallKeep like below.

  NSDictionary *audioSession = @{
    @"categoryOptions": @(AVAudioSessionCategoryOptionAllowBluetooth),
    @"mode": AVAudioSessionModeVoiceChat
  };
  
  [RNCallKeep setup:@{
    @"appName": @"My App",
    @"maximumCallGroups": @1,
    @"maximumCallsPerCallGroup": @1,
    @"includesCallsInRecents": @NO,
    @"supportsVideo": @NO,
    @"imageName": @"app-icon.png",
    @"audioSession": audioSession
  }];

Still no any improvements.

When I tried to run RNCallKeep.setAudioRoute(systemId, audioRouteName); with below parameters to forcefully set the audio route to phone. But still having issues with it.

RNCallKeep.setAudioRoute(<some id>,"phone");

So can anyone help me to get through this. Thank you.


Solution

  • Okay. After 2 weeks of searching I have found a solution to this issue. Seems in RNCallKeep library when you end the call if you used normal RNCallKeep.endCall() function, there may be some AudioSession can be hanging there and cause audio issues for the next calls. So my fix was calling RNCallKeep.endAllCalls() instead. So then this will clear all the audio sessions and restore the default configurations. This was fixed my audio issues.