react-native-incall-manager icon indicating copy to clipboard operation
react-native-incall-manager copied to clipboard

iOS incomming call issue

Open sm2017 opened this issue 6 years ago • 14 comments

I have a problem with incall manager , when iOS device has incomming webrtc call , the webrtc just transfer video , not voice In android , everything works , in iOS outgoing call works

I see in your readme Fix iOS audio shared instance singleton conflit with internal webrtc. is a TODO , is it relative to my issue?

sm2017 avatar Mar 10 '18 05:03 sm2017

@zxcpoiu can you help me?

sm2017 avatar Mar 13 '18 05:03 sm2017

No, it's not related. It just means that webrtc internally change audio category which may overrides our audio route preference, like we want it routes to EarPiece but be overridden to SpeakerPhone instead. The audio should plays as well but may in not preferred route.

I think you should simplify all your code down to pure webrtc, for example, use https://github.com/oney/RCTWebRTCDemo without bother incall manager and audio route first, to check where the problem lies on.

zxcpoiu avatar Mar 13 '18 08:03 zxcpoiu

@zxcpoiu When I comment all codes related to react-native-incall-manager I have no issue , and incomming/outgoing voice/video call from/to android/ios works well

I just use startRingtone('_DEFAULT_') for incoming call, start({media: 'audio', ringback: '_BUNDLE_'}) for outgoing , InCallManager.stopRingtone() ,InCallManager.stop() and InCallManager.stop({busytone: '_BUNDLE_'}) and nothing else

I know that startRingtone('_DEFAULT_') is problem , When I just comment startRingtone('_DEFAULT_') everything works , but when startRingtone('_DEFAULT_') commented out , incomming call to iOS is an issue and there is no voice (But video) transfer

sm2017 avatar Mar 13 '18 09:03 sm2017

@zxcpoiu I found that the issue is InCallManager.stopRingtone() not startRingtone('_DEFAULT_')

I comment InCallManager.stopRingtone() and uncomment startRingtone('_DEFAULT_') , Next , In call , in both side we hear ringtone and our voice

sm2017 avatar Mar 14 '18 10:03 sm2017

Hmm...I'm kind of lost. So, what exactly step you have this issue?

InCallManager.stopRingtone() is supposed to be called after InCallManager.startRingtone('_DEFAULT_')

And during a call, there should have no ringtone related function calls.

zxcpoiu avatar Mar 26 '18 16:03 zxcpoiu

I am using redux middleware to manage ringtone

InCallManager.startRingtone('_DEFAULT_') is executed when new incoming call received

I found that if I call InCallManager.stopRingtone() then getUserMedia, your library has no conflict with webrtc library , and both android and iOS works well

But if you call getUserMedia then InCallManager.stopRingtone() we have issue just in iOS not android

sm2017 avatar Mar 29 '18 08:03 sm2017

I am experiencing the same issue. However I can getUserMedia in the very beginning before I even make the call, so I am currently unable to find a workaround form this issue. I will keep digging

yananym avatar Mar 29 '18 22:03 yananym

Same problem !!

florindumitru avatar Jul 24 '18 06:07 florindumitru

What if you invoke start when call is picked up?

ex:

StartRingtone()
getUserMedia()
StopRingtone() # --- after getUserMedia, conflict!

start() # --- invoke start() to see what happen, does it works normally?

I think this issue lines on that AudioSession is a singleton, and startRingtone / stopRingtone saved your original AudioSession category and restored them at the end.

If this is the case, the workaround would be: keep track and override AudioSession Mode and Category in your app logics, rely on your app logic, not this plugin nor webrtc.

zxcpoiu avatar Sep 20 '18 05:09 zxcpoiu

Hello !

I'm facing kind of same issue there, when I call stopRingtone, it seems it cut all incoming sound from calls. I'm not using this library for calls, but when I call stopRingtone, I'm unable to receive sound from my caller. It's like all sound are cut, but only on IOs. Android works good.

If someone have info, I'm not yet enough experimented to fix objective-c and swift issues, but if someone is available, feel free to answer :)

Sincerely, Florient

Linoa65 avatar Jan 18 '19 10:01 Linoa65

hi @sm2017 , can u guide me how to using RNInCallManager.start function? I have using with RNCallKeep, it's already using configAudioSession with incomming call, so can I using start() function for incoming call case?

fukemy avatar Oct 24 '22 09:10 fukemy

Has a solution been found for this iOS audio issue? I am facing the same issue, for me everything works fine for the first time, but second time audio is not working for both users.

prathamesh-wrktalk avatar Oct 25 '23 12:10 prathamesh-wrktalk

this work to me:

 InCallManager.start({media: isVideo ? 'video' : 'audio', ringback: '_BUNDLE_'})
 getUserMedia()

fukemy avatar Jan 15 '24 04:01 fukemy

in my case I just needed to call stopRingtone before setting remote description and create answer

`async function processAccept() { setType('CALLING_ROOM'); InCallManager.stopRingtone();

peerConnection.current
  .setRemoteDescription(new RTCSessionDescription(remoteRTCMessage.current))
  .then(() => {
    pendingCandidates.forEach(candidate => {
      peerConnection.current
        .addIceCandidate(candidate)
        .then(() => {
          console.log('SUCCESS');
        })
        .catch(err => {
          console.log('Error', err);
        });
    });

    // Clear the candidates list
    pendingCandidates = [];
  })
  .catch(error => {
    console.log('Error in setting remote description', error);
  });
const sessionDescription = await peerConnection.current.createAnswer();
await peerConnection.current.setLocalDescription(sessionDescription);

answerCall({
  callerId: otherUserId.current,
  rtcMessage: sessionDescription,
});


setCallingList(callData);

}`

I call this function when user press accept call button , may it helps to you guys

nikhil2882 avatar Apr 27 '24 13:04 nikhil2882