Comments (6)
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.js
on my project, just import my CallkeepService and call the setup method). Important to not forget to implement thedidLoadWithEvents
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 bothanswerCall
andendCall
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 thelocaldescription
...) - So I just store all the data
offer
and all thecandidates
on my DialerService file, but I didn't do anything yet! - Only after the
answerCall
or theRNCallKeepPerformAnswerCallAction
(when the user has answered on Apple's CallKit) I will start to process theoffer
and all thecandidates
, and after of course signal back with ananswer
. - 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.
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.
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.
hi @NIyerAD , can u provide the solution? Im stucking with no audio inside my app at 7 days
from react-native-callkeep.
Hi,
Any update on this, I am facing the same issue
thanks in advance
from react-native-callkeep.
Same here
from react-native-callkeep.
Related Issues (20)
- I Created a Discord Server for the React Native Callkeep Community :) Please join!
- Sending `RNCallKeepDidChangeAudioRoute` with no listeners registered HOT 11
- iOS 16 app is not opening after answering in lockscreen HOT 17
- [Android] - Cannot speak or listen after initiating a call while the app has exited
- NSRangeException on getAudioOutput
- Audio is not routed to speaker on incoming call on Android HOT 1
- Caused by java.lang.NoSuchMethodError: No virtual method stopForeground on Android 6 HOT 3
- Audio routing on Android is not routing to Speaker
- Crash app (android 13) when use RNCallKeep.setup
- How do you control the call's volume programatically on iOS? HOT 2
- getAudioRoutes definition returns Promise<void>, but should return Promise<AudioRoute[]>
- No calling UI when receiving a call on iOS 17.1.1 HOT 3
- How to backToForeground IOS
- [iOS] Declining Incoming Call to SIM number triggers `endCall` event HOT 14
- Call not ending on remote device if call was declined too fast on iOS HOT 3
- call keep crash : index 0 beyond bounds for empty array HOT 4
- Is there a way to specify the ringtone on Android?
- PhoneAccount Connection service requires BIND_TELECOM_CONNECTION_SERVICE permission HOT 1
- The Speaker icon is removed, while switching the route from Bluetooth or Microphone to Speaker from the call kit screen. HOT 1
- [TypeError: Cannot read property 'setup' of null] when call setup HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-callkeep.