# Ios, audio output management problem

**URL:** <https://react-native-webrtc.discourse.group/t/ios-audio-output-management-problem/1415>\
**Category:** iOS\
**Created:** [November 16, 2021, 11:03am UTC](https://react-native-webrtc.discourse.group/t/ios-audio-output-management-problem/1415 "2021-11-16T11:03:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flhember](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/flhember/32/536_2.png) [@flhember](https://react-native-webrtc.discourse.group/u/flhember)\
**Post date:** [November 16, 2021, 11:03am UTC](https://react-native-webrtc.discourse.group/t/ios-audio-output-management-problem/1415/1 "2021-11-16T11:03:52Z")

</div>

Hi,

I’m trying to create an app with Webrtc call.  
The calls work perfectly, but I would like to set by default the audio output to phone speaker.  
And if there is a bluetooth connection, switch audio on the bluetooth device.  
For that I use react-native-incall-manager, on android everything works fine.  
But on ios, only the first call works, after the sound doesn’t work anymore.

The problem is known, a solution was proposed but I do not know how to apply it.

> <https://github.com/react-native-webrtc/react-native-incall-manager/issues/152>
>
> HI.
> 
> I'm building an app and have some issue.
> Here is my scenario.
> 
> \`\`\`java…script
> // Establish WebRTC Connection
> InCallManager.start({ media: 'video', auto: true });
> // Communicate through RTC Connection
> 
> // After all communications done
> InCallManager.stop();
> 
> // Re-establish WebRTC Connection 
> InCallManager.start({ media: 'video', auto: true });
> \`\`\`
> 
> Here is problem.
> When I re-establish the connection and start InCallManager again, the Audio doesn't works at all, 
> i.e. Mic input and Speaker output.
> 
> My assumption is due to IOS AVAudioSession, because WebRTC assumes that it's the only one controls AVAudioSession which is implemented as a singleton.
> 
> Am I right? and how can I fix it? (or do you have any plan for fixing it?)
> 
> React-Native-IncallManager Version : v3.3.0
> libWebRTC : M84

I need a help, Thanks for reading me

---

<div class="post-metadata">

**Author:** ![jbaudanza](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/jbaudanza/32/387_2.png) [@jbaudanza](https://react-native-webrtc.discourse.group/u/jbaudanza)\
**Post date:** [November 26, 2021, 6:45pm UTC](https://react-native-webrtc.discourse.group/t/ios-audio-output-management-problem/1415/2 "2021-11-26T18:45:07Z")

</div>

Don’t use react-native-incall-manager on ios. Instead, just update the AVAudioSession directly from your ApplDelegate.m. Something like this:

```auto
#import <WebRTC/RTCAudioSessionConfiguration.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  RTCAudioSessionConfiguration *webRTCConfiguration = [RTCAudioSessionConfiguration webRTCConfiguration];

  webRTCConfiguration.categoryOptions = (AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionDefaultToSpeaker);
}

```
