twilio / twilio-voice-react-native

Other
72 stars 27 forks source link

Receiving calls stops working on the iPhone after a while. #369

Closed greenraze13 closed 3 months ago

greenraze13 commented 4 months ago

Issue

Pre-submission Checklist

Description

I am testing calls from Android to iOS. The call is received on the iPhone while in the foreground and background. However, after some calls, it stops working in the app's killed state on the iPhone. I delete the app from the iPhone and then reinstall it. The call works fine again on the iPhone in the killed state, but after some calls, no call is received in the app's killed state. The call always works fine in the foreground. In xcode project in sigining and capbilities background modes on for Voip.That why app works fine for a while. I have integrated the sentry Where received error related to voip NSInternalInconsistencyException: Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push.

Reproduction Steps

  1. Install app on android
  2. Call from android client to client
  3. Receive call on iphone app
  4. Call will receive on iphone but after some calls not receiving while iphone app is in killed state (fine in foreground state )

Expected Behavior

Iphone app should receive the call while in killed state every time

Actual Behavior

On start of testing call from android to iphone app worked fine on both fore ground and killed state. But after some times / some calls iphone app is not receiving the calls while in killed state.

Reproduction Frequency

Issue can be produce by calling multiple times from android to iphone.Pick some calls and after some times iphone app will stop works while app is in killed state.

Software and Device Information

Please complete the following information.

bobiechen-twilio commented 4 months ago

Hi @greenraze13

The message NSInternalInconsistencyException: Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push. indicates that the component that handles the iOS PushKit events might not be instantiated to report the VoIP push notification to the iOS CallKit framework as an incoming call. Is your application calling the Voice.initializePushRegistry() method or handles the PushKit events in a different module?

greenraze13 commented 4 months ago

Hi @bobiechen-twilio Thanks for your response. I am calling await voice.initializePushRegistry() function like below This is useVoice hook. React.useEffect(() => { voice.getVersion().then(setSdkVersion); const bootstrap = async () => { if (Platform.OS === 'ios') { await voice.initializePushRegistry(); } const calls = await voice.getCalls(); for (const call of calls.values()) { console.log('existing call', call.getCustomParameters()); callHandler(call); } const callInvites = await voice.getCallInvites(); for (const callInvite of callInvites.values()) { console.log('existing call invite', callInvite.getCustomParameters()); callInviteHandler(callInvite); } }; bootstrap(); voice.on(Voice.Event.CallInvite, callInviteHandler); voice.on(Voice.Event.AudioDevicesUpdated, audioDevicesUpdateHandler); return () => { voice.off(Voice.Event.CallInvite, callInviteHandler); voice.off(Voice.Event.AudioDevicesUpdated, audioDevicesUpdateHandler); }; }, [ audioDevicesUpdateHandler, callHandler, callInviteHandler, voice, ]);

greenraze13 commented 4 months ago

Hi @bobiechen-twilio Any update here ?

bobiechen-twilio commented 4 months ago

Hi @greenraze13

Have you tried the example app with your environment? The example app is able to receive incoming calls when the app was previously terminated

greenraze13 commented 3 months ago

@bobiechen-twilio Hi Thanks .I have tried that its working fine now.

bobiechen-twilio commented 3 months ago

Glad to see it's working for you now @greenraze13 Is it possible for you to share the fix you did in your app so the terminated app is able to wake up and handle the incoming call?

greenraze13 commented 3 months ago

@bobiechen-twilio Yes in killed state App is working fine and now every time and its receiving calls The thing is now I awaking this await voice.initializePushRegistry() in App.tsx file.