Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incoming calls not working Voice React Native SDK #432

Open
3 tasks
spaculusaninja opened this issue Oct 1, 2024 · 23 comments
Open
3 tasks

Incoming calls not working Voice React Native SDK #432

spaculusaninja opened this issue Oct 1, 2024 · 23 comments
Assignees
Labels
needs more info Needs more info from the issue author.

Comments

@spaculusaninja
Copy link

Issue

Pre-submission Checklist

  • I have verified that the issue occurs with the latest release and is not marked as a known issue in the CHANGELOG.md.
  • I reviewed the Common Issues and open GitHub issues and verified that this report represents a potentially new issue.
  • I am not sharing any Personally Identifiable Information (PII)
    or sensitive account information (API keys, credentials, etc.) when reporting this issue.

Description

After following the setup steps for Android and ios in the Twilio Voice React Native SDK documentation (version 1.2.0), I was able to successfully register for incoming calls, as indicated by the Successfully registered for incoming calls message in the voice.on(Voice.Event.Registered) event. However, incoming calls do not seem to work as expected afterward. No incoming call notifications or callbacks are triggered.

Reproduction Steps

  1. Completed all steps as described in the Twilio Voice React Native SDK documentation.
  2. Set up a Firebase project and linked it for FCM.
  3. Followed instructions for Twilio Push for FCM HTTP v1 API as described here.
  4. Registered for incoming calls using the Twilio SDK with:
    voice.on(Voice.Event.Registered, () => {
    console.log('Successfully registered for incoming calls');
    });
    5.No further events or notifications were triggered for incoming calls.

Expected Behavior

Incoming calls should trigger an appropriate event or notification, and the voice.on(Voice.Event.CallInvite) event should be fired when a call is received.

Actual Behavior

After the "Successfully registered for incoming calls" message, incoming calls are not detected by the app. No event is triggered, and the incoming call is not received.

Reproduction Frequency

The issue occurs 100% of the time.

Software and Device Information

Device: [e.g. Oppo F21 pro, iphone 14]
OS: [e.g. Android 14, ios 17]
React version: 18.2.0
React Native version: 0.74.3
Node version: 18.17.0
npm version: 9.6.7
Twilio Voice React Native SDK version: 1.2.0

@mhuynh5757
Copy link
Collaborator

Hello @spaculusaninja thanks for reaching out. Are you using @react-native-firebase/messaging in your application alongside our SDK? There are known issues with using both that our team is trying to resolve.

@spaculusaninja
Copy link
Author

Hello @mhuynh5757, thank you for your response. Yes, I am using @react-native-firebase/messaging in my application alongside Twilio Voice React Native SDK. Could you please provide an estimated timeline on when this issue might be resolved? Any workarounds in the meantime would also be greatly appreciated.

Looking forward to your feedback.
Screenshot 2024-10-15 at 12 52 38 PM

@mhuynh5757
Copy link
Collaborator

Hi @spaculusaninja we're close to merging a fix to main, please sit tight! After merging this week, we'll also cut a release this week. But in the meantime, if you're feeling adventurous and don't mind testing the branch before we merge, that's also an option for you. The branch is task/disable-firebase-service.

@spaculusaninja
Copy link
Author

"Hi @mhuynh5757,
Thank you for your quick response and for working on the fix. I appreciate your efforts to merge the solution to the main branch and plan for a release this week.
Following your suggestion, I decided to test the 'task/disable-firebase-service' branch. I carefully followed the instructions provided in the documentation (https://github.com/twilio/twilio-voice-react-native/blob/main/docs/out-of-band-firebase-messaging-service.md). However, I'm still experiencing issues with push notifications and incoming calls in the Voice React Native SDK.
Could you please provide any additional troubleshooting steps or insights that might help resolve these persistent issues? Are there any known limitations or specific configurations that I should be aware of when testing this branch?

@spaculusaninja
Copy link
Author

Here are screenshots.
Screenshot 2024-10-24 at 5 51 27 PM
Screenshot 2024-10-24 at 6 01 31 PM
Screenshot 2024-10-24 at 6 04 37 PM

@mhuynh5757
Copy link
Collaborator

Could you share the parameter value that you're passing to voice.handleFirebaseMessage when you encounter this error? You can just share the keys/structure, the values of the object can be redacted for your privacy.

@spaculusaninja
Copy link
Author

Hi mhuynh5757,
I’m not receiving any remoteMessage notifications in either the foreground or background. I also tested the setup using this tool, but I still don’t receive any notifications.
Any advice on troubleshooting steps would be really helpful. Thanks!

@mhuynh5757
Copy link
Collaborator

Hi @spaculusaninja, just to confirm, you're using the @react-native-firebase/messaging package? And you have something like

import messaging from '@react-native-firebase/messaging';

messaging().onMessage(async (remoteData) => {
  ...
});

in your application somewhere?

It's best to have this invocation as early as possible in your application lifecycle, as noted in the docs. Could you add a console log to help us debug?

messaging().onMessage(async (remoteData) => {
  console.log(remoteData.data);
});

Or is the issue that this function is not firing at all?

@mhuynh5757 mhuynh5757 self-assigned this Oct 30, 2024
@mhuynh5757 mhuynh5757 added the needs more info Needs more info from the issue author. label Oct 30, 2024
@spaculusaninja
Copy link
Author

Hi @mhuynh5757,

Yes, I am using the @react-native-firebase/messaging package, and I have included this in my application:

import messaging from '@react-native-firebase/messaging';

messaging().onMessage(async (remoteData) => {
console.log(remoteData.data); // Added console log for debugging
});

However, the issue is that messaging().onMessage() is not firing at all. I’ve already placed this invocation early in the application lifecycle to ensure it initializes as soon as possible.

I've also double-checked permissions and tried adding console logs to debug, but still no response from the onMessage function. Any additional suggestions on troubleshooting would be appreciated!

Thanks in advance for the help!

@mhuynh5757
Copy link
Collaborator

Hi @spaculusaninja I see. Unfortunately, this package is not within the scope of our project, it is a 3rd party package after all. I can try to assist you as much as possible, but I cannot help you with bugs in packages not our own.

Can you try to uninstall your app and reinstall it on your device? When Firebase messaging services declare listeners, they use an FCM Device token internally. Reinstalling the app forces this token to refresh. It may help your situation.

Also, we released 1.2.1 today, so you no longer have to use a pre-release version from the branch. Please upgrade at your earliest convenience, thanks for your patience!

@spaculusaninja
Copy link
Author

spaculusaninja commented Nov 4, 2024

Hi @mhuynh5757,

Thank you for the update and the recommendation! I’ve successfully updated to version 1.2.1 of @twilio/voice-react-native-sdk, and I also reinstalled the app to refresh the FCM Device token. Notifications are now working fine, but I’m still experiencing issues with incoming calls – they don’t seem to come through even after the successful registration for incoming calls.

I’ve double-checked the setup and ensured all listeners and permissions are configured as recommended. Is there any additional troubleshooting you’d suggest to resolve the incoming call issue, or any specific logs that might help identify the problem?

Thanks again for your support!

Note(mhuynh): I've redacted the access token for your privacy.

@spaculusaninja
Copy link
Author

Screenshot 2024-11-04 at 6 58 35 PM

@spaculusaninja
Copy link
Author

Screenshot 2024-11-04 at 7 00 01 PM

@spaculusaninja
Copy link
Author

Screenshot 2024-11-04 at 7 02 04 PM

@spaculusaninja
Copy link
Author

spaculusaninja commented Nov 4, 2024

Here is Notification payload receive from FCM :-
remoteMessage------ {"collapseKey": "com.****", "data": {"ignoreInForeground": "true", "notif_trigger_local": "1", "notif_type": "silent", "sub_message": "Missed call"}, "from": "169349367722", "messageId": "0:1730727254720565%2a1733d62a1733d6", "notification": {"android": {}, "body": "Missed call", "title": "Missed call - Auto-created from Missed Call (+16179152997)"}, "originalPriority": 1, "priority": 1, "sentTime": 1730727254712, "ttl": 2419200}

@spaculusaninja
Copy link
Author

spaculusaninja commented Nov 4, 2024

Here is error log screenshot
Screenshot 2024-11-04 at 7 09 07 PM

@spaculusaninja
Copy link
Author

Here is call log screenshot
Screenshot 2024-11-04 at 7 11 34 PM

@mhuynh5757
Copy link
Collaborator

Hello @spaculusaninja thanks for the additional info. It seems like you're receiving Firebase messages unrelated to Twilio, and it's causing parsing errors expectedly. Here's an example of a Firebase message that will be parsed correctly:

{
  "twi_account_sid": "",
  "twi_answer_timeout": "",
  "twi_bridge_token": "",
  "twi_call_sid": "",
  "twi_from": "",
  "twi_message_id": "",
  "twi_message_type": "",
  "twi_params": "",
  "twi_to": ""
}

I recommend that you do some checks in your application code to ensure that the data that you pass to voice.handleFirebaseMessage has that exact structure (of course the values of the record have been redacted, but the keys are as they should be).

@spaculusaninja
Copy link
Author

Hi @mhuynh5757,

Thank you for the clarification and example message structure.

Could you please confirm if there are any additional required fields or permissions on the Android sid

@spaculusaninja
Copy link
Author

spaculusaninja commented Nov 6, 2024

Screenshot 2024-11-06 at 7 20 39 PM

@spaculusaninja
Copy link
Author

Screenshot 2024-11-06 at 7 21 42 PM

@mhuynh5757
Copy link
Collaborator

That looks more than sufficient. If you need any examples for those files, you can check the Test App that we use to test the RN SDK which can be found under test/app/ or the Reference App. You can find more about the Reference App in our Readme.

@spaculusaninja
Copy link
Author

Hi @mhuynh5757,

Thank you for the suggestion! I’ve set up the config as mentioned in the SDK documentation, and everything seems to be configured correctly. However, I’m still experiencing issues with calls not working as expected. Could you provide any guidance or troubleshooting steps that might help pinpoint the issue? Additionally, if there are any specific parts of the Test App or Reference App you recommend for checking configuration, I’d appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Needs more info from the issue author.
Projects
None yet
Development

No branches or pull requests

2 participants