twilio / twilio-voice-react-native

Other
67 stars 26 forks source link

[IOS] If app is in killed state, How to accept or reject incoming call in IOS? #405

Open himanshupkarak opened 3 weeks ago

himanshupkarak commented 3 weeks ago

Issue

Accept and Reject buttons are not working, If received an incoming call on killed state in IOS

Pre-submission Checklist

Description

accept and reject not working for killed state incoming call in IOS.

Reproduction Steps

Expected Behavior

User can accept or reject incoming call from IOS native UI screen.

Actual Behavior

can not accept or reject

Reproduction Frequency

In my case, It's 100%

Screenshots

Software and Device Information

Please complete the following information.

Additional Context

mhuynh5757 commented 3 weeks ago

Hi @himanshupkarak are you experiencing crashes or are you not seeing UI pop up when attempting to receive an incoming call? Are you able to receive incoming calls when the app is not in the killed state? If you experiencing crashes, please provide Xcode logs. Finally, can you confirm that you're using a real iOS device, and not the iOS simulator? The Twilio Voice SDKs will not work on iOS simulators.

himanshupkarak commented 3 weeks ago

HI @mhuynh5757 i am not experiencing any crash on incoming call with any state (foreground, background or killed) not even after accepting or rejecting call.

the issue is (only for killed state), when i click on accept (from IOS native UI) my call decline if i click on reject (2 times), my call also decline

*here are some screenshots to understand more.

WhatsApp Image 2024-08-22 at 14 16 24 WhatsApp Image 2024-08-22 at 14 16 29

one more thing,

-> voice.addListener(Voice.Event.CallInvite, handlePendingCallInvite);

-> callInvite.on(CallInvite.Event.Accepted, async (res) => { console.log('check response', res) })


please help!!

himanshupkarak commented 3 weeks ago

yes, I am using a real iOS device

mhuynh5757 commented 3 weeks ago

Thanks for the update @himanshupkarak. When CallInvites are accepted through the native UI and the JS runtime is not started, for example when your app is backgrounded or closed, you are indeed correct that the callInvite.on(CallInvite.Event.Accepted, ...) event will not fire. Instead, on JS runtime start, you should invoke voice.getCalls() to get all ongoing calls. Please see how our test app does this: https://github.com/twilio/twilio-voice-react-native/blob/main/test/app/src/hook.ts#L479