team-telnyx / telnyx-webrtc-android

Telnyx Android WebRTC SDK - Enable real-time communication with WebRTC and Telnyx
MIT License
13 stars 2 forks source link

[Bug] Received multiple incoming call firebase notifications for the same call. #307

Closed Del-S closed 11 months ago

Del-S commented 1 year ago

Bug Category

SDK Version implementation 'com.github.team-telnyx:telnyx-webrtc-android:v1.2.20-alpha'

Describe the bug We received multiple firebase notifications for the same call. The app cannot decide which is the real one and accept the invitation.

Expected behaviour We should receive only one notification.

To Reproduce Steps to reproduce the behaviour:

  1. Login to tenyx.
  2. Connect firebase notifications.
  3. Create incoming call.

Android Device (please complete the following information):

Logs

2023-06-30 11:18:27.701 18842-18946 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"c64d5ac6-683f-4b52-91ec-a696da75d5b6"}, message=Incoming call!})
2023-06-30 11:18:31.374 18842-18951 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"f237c558-0ce5-43d9-b3d4-03d94b431043"}, message=Incoming call!})
2023-06-30 11:18:36.781 18842-18957 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"b3d5792a-e9f0-4812-b030-386db093d322"}, message=Incoming call!})

How can we receive 3 notification in the manner of seconds for the same call with a diffrent call ID?

Del-S commented 1 year ago

Oh I found what was causing it. We were not able to establish connection to Telnyx client. So that issue is probably on me. But I wonder why is the call_id changing? It is still the same call no?

Del-S commented 1 year ago

Having multiple call id's now causes app crashing when ending the call that does not exist: #310.

Del-S commented 1 year ago

Another issue with the FCM implementation is that when device is not active it will receive multiple call notifications even though the calls are not active anymore:

2023-07-07 13:16:33.359 14433-14541 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"36c2612c-c2f1-48be-b9e1-3a9cc5f1e245"}, message=Incoming call!})
2023-07-07 13:16:38.364 14433-14561 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"7d51ac3f-bdfd-4c41-bc90-5dbe00c0deec"}, message=Incoming call!})
2023-07-07 13:16:43.382 14433-14568 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"6d245605-98da-4e62-8020-97bb7d5f76c5"}, message=Incoming call!})
2023-07-07 13:17:10.295 14433-14587 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"4127559a-78c6-4764-b44e-7d51920d034b"}, message=Incoming call!})
2023-07-07 13:17:16.190 14433-14593 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"054884f9-9e14-4ddd-96cc-26a777809944"}, message=Incoming call!})
2023-07-07 13:17:21.961 14433-14600 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"6a7a44ef-26e2-46e0-8e7a-1d829f19427a"}, message=Incoming call!})
2023-07-07 13:18:06.174 14433-14630 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"360f3c01-f7d1-4623-9f74-cf9d9ee99b46"}, message=Incoming call!})
2023-07-07 13:18:11.940 14433-14637 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"3a407250-14cc-432a-96c4-37c42e8e5661"}, message=Incoming call!})
2023-07-07 13:18:17.645 14433-14644 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"b119a101-df03-4f99-9920-3451a0b9d506"}, message=Incoming call!})
2023-07-07 13:18:23.330 14433-14650 handleDataMessage({metadata={"caller_name":"420732652757","caller_number":"420732652757","call_id":"6966c7ff-949e-4709-aaed-f8705c19de38"}, message=Incoming call!})

So it actually triggered the call UI in the application. What is the best way to handle this situation?

Del-S commented 11 months ago

So the correct way is to update callId with the new one and use that one to end the call. Okay.