react-native-webrtc / react-native-callkeep

iOS CallKit framework and Android ConnectionService for React Native
ISC License
926 stars 445 forks source link

When the app is in background event listener endCall does not fire requests until app is re-opened #520

Open brandudno opened 2 years ago

brandudno commented 2 years ago

Bug report

Description

When I have my app in the background and I receive VoIP notification and I reject/decline the call, I can see my event listener (endCall) is triggered by my logs, however I have a service API call within this method that should send a request to the server to notify that the call has been rejected.

`RNCallKeep.addEventListener('endCall', (callDetail: any) => { console.log('endCall is triggered'); RNCallKeep.backToForeground();

const stompService = new StompService(null); stompService.rejectIncomingCall(callDetail.callUUID); RNCallKeep.reportEndCallWithUUID(callDetail.callUUID, 2); });`

My stomp service request is not sent until I manually re-open the app, backToForeground seems to make no difference.

Versions

- Callkeep: 4.3.1
- React Native: 0.64.2
- iOS: 14.7.1
- Phone model: iPhone XS Max
jonastelzio commented 2 years ago

So, you're getting endCall is triggered printed in your logs, correct? It's whatever goes on inside stompService.rejectIncomingCall(callDetail.callUUID); that doesn't do anything?

If so, what are you doing inside that method? React Native stops firing RCT Timers immediately when Callkit doesn't have any calls running, so if you're doing any sort of timers, immediates or anything like that, those won't be executing.

The only work around is to either get Facebook to make react native execute timers in the background, or write something that hooks into IOS background execution framework and kick RCTTimers alive yourself.

leahberkovits commented 2 years ago

trying this before end call: RNCallKeep.reportEndCallWithUUID(callUUID, 2);

chopper2201 commented 2 years ago

Hi @brandudno , Do you have any solutions for this case? Currently I'm facing the same issue here

danilo-dsf commented 2 years ago

Hi, @brandudno. I'm having the same issue. Do you have any solutions for this case?