Giter VIP home page Giter VIP logo

Comments (6)

ssimoe50 avatar ssimoe50 commented on May 21, 2024 1

I was looking for similar issues to mine. I found this one. Honestly it didn't fix my issue, but put me in a different perspective.
So in a way it help me rethink my normal approach when working with CallKeep and WebRTC on iOS (on Android I've a custom integrated dialer and call UI so I don't use Callkeep). I got 2 service files: CallkeepService (for all the listeners and events) and DialerService (for all the WebRTC and Audio management)

For other people that might face it here is what I've done:

  • I've completely rework my call flow for iOS only. On Android, didn't had any issues. So this is focus only on iOS keep that in mind...
  • When I receive my first notification, a VoIP notification (highly recommended!), I add the Callkeep code, initialize/setup and to display the call UI from Apple's CallKit directly on the AppDelegate. --> See react-native-voip-push-notification to be able to use Apple's PushKit for VoIP.
  • Implement the Callkeep listeners as soon as possible (I've went with the root index.json my project, just import my CallkeepService and call the setup method). Important to not forget to implement the didLoadWithEvents listener for when the app has been manually or forced close (ie. not in background, so completely closed), so when the app loads you can get the events that have been triggered prior to JS startup. (Usually you'll have at least 3 important events to look: RNCallKeepDidDisplayIncomingCall,RNCallKeepPerformAnswerCallAction,RNCallKeepPerformEndCallAction).
  • These 3 events from the listener didLoadWithEvents or both answerCall and endCall listeners are related to the user actions on the Apple's CallKit (ie. call screen).
  • While the device is handling the actions on CallKit, you might already be receiving some background notifications related to the WebRTC process, don't process anything or signal back anything just yet! (This is where I was mostly doing it wrong! I was creating the peerconnection, even tho I wasn't yet adding tracks or the localdescription...)
  • So I just store all the data offer and all the candidates on my DialerService file, but I didn't do anything yet!
  • Only after the answerCall or the RNCallKeepPerformAnswerCallAction (when the user has answered on Apple's CallKit) I will start to process the offer and all the candidates , and after of course signal back with an answer.
  • And then just follow the "normal" WebRTC process.
  • Important to alert too, that I don't use any audio methods from CallKeep! All the audio management I do using react-native-incall-manager. This is so much better!
  • On my DialerService file I really only use 3 methods from Callkeep: RNCallKeep.rejectCall, RNCallKeep.endCall, RNCallKeep.endCalls (this last one it's on my clean up method just in case something got stuck).

Well this is more or less what I did! I spent 4 full days working on this, I'm writing here at the very end and late in the night, so I apologize if my train though is a little messy and confusing, but I think I got most of it out.

Hope this might help someone else, other than me!
Cheers mates!

from react-native-callkeep.

rcidt avatar rcidt commented on May 21, 2024

I am getting the same thing. It definitely has to do with the Audio Session. I think the call will have no audio if the SIP call is established before the Audio Session is activated.

I need to start handling the call after the didActivateAudioSession event fires, but it only fires on the first call I make, subsequent calls do not trigger the event. Looking into a solution.


Update:

The reason didActivateAudioSession only fired the first time a call was handled was due to another bug where endCall(UUID) wasn't actually disconnecting the CallKit Session. I fixed that bug by calling endAllCalls() instead.

Now every time I end a call, the CallKit Session is terminated along with the Audio Session.

My code now looks something like this

const audioHandler = () => {
    // we only want this listener fired once per call, so make sure to remove it
    Call.removeEventListener('didActivateAudioSession', audioHandler)
    // do whatever you need to do to handle the incoming/outgoing call
    ...            
}
Call.addEventListener('didActivateAudioSession', audioHandler)

Hope this helps anyone with this bug.

Overall there seem to be a lot of bugs with CallKit/this lib. But either way it looks like we wont have to deal with this long, this feature is going away May 2020 since iOS will no longer support it due to privacy concerns.

from react-native-callkeep.

NIyerAD avatar NIyerAD commented on May 21, 2024

Thanks for your help, @rcidt. I thought it may have been something to do with the audio session. I'm handling the call after didActivateAudioSession event fires but there's still no audio. This happens when the first incoming call arrives so I don't think that it's an issue with ending all of the calls first.

from react-native-callkeep.

fukemy avatar fukemy commented on May 21, 2024

hi @NIyerAD , can u provide the solution? Im stucking with no audio inside my app at 7 days

from react-native-callkeep.

ashirkhan94 avatar ashirkhan94 commented on May 21, 2024

Hi,
Any update on this, I am facing the same issue
thanks in advance

from react-native-callkeep.

abpbackup avatar abpbackup commented on May 21, 2024

Same here

from react-native-callkeep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.