Issue in receiving incoming calls

Hi there,

I’ve updated the SDK from 1.2.4 to 1.3.0 but the incoming calls are received only after I end the call on the caller’s device and the native incoming call screen appears on the callee’s device for 1-2 seconds then disappears. Didn’t happen before on previous version.
I’ve looked several times over your documentation and sample app and everything looks just fine, as I said, didn’t encounter this issues on 1.2.4 version. Do you have any idea why?

Thanks for your help :grinning:

1 Like

@Robert_Havrisciuc

Hi there, thank you for posting.

Please might I ask the platform you are using Android or iOS?

@Jason

Hi, sure. It’s on iOS. Have XCode 12 and it’s happening on both iOS 13 and 14.

Thanks

@Robert_Havrisciuc
Hi, thanks for the report.
Are you using VoIP Push Notifications with your application? We think that there may be some problem in the push notifications settings.

There were some improvements in how the push notification was processed after version 1.2.6 which fixed some loopholes.

Could you test the feature on version 1.2.6, please? If the problem persists, it could indicate that the VoIP Push notification is improperly configured and the notifications are not being delivered at all.

@mininny
Hi, appreciate your help.

Yes, I am using VoIP Push Notification within the app. But somehow managed to fix this on 1.3.0, don’t know if it’s the best way but for now it’s working. In SendBird Dashboard, under Settings -> Notifications, I removed VoIP Certificate for Incoming Calls as Notification type and left only the APN Certificate for Alerts as Notification type.

Want to go with the 1.3.0 version in order to add a dial ringtone and the addDirectCallSound is only in 1.3.0 version.

Still having one issue regarding receiving incoming calls if you might help. On the callee’s device, if I tap either on Missed Call Notification or opening the app after the caller ended the call, I see for 1-2 seconds the native incoming call and then disappears.

Thanks!

@Robert_Havrisciuc
Hi, thanks for the detail.

Are you saying that the VoIP Push Notifications are arriving after you’ve disabled Incoming Calls from the Dashboard and enabled Alerts? Or are you just using Alerts instead of Incoming Calls?

@mininny

I am using Alerts instead of Incoming Calls because that’s the way I want the app to work, receiving incoming calls only via Push Notifications when the app is in background or the phone is locked.

But, when the app is in foreground, the incoming call is received through the established connection with SendBird servers - which is how I wanted to work and it’s working.

The only problem as I said, on the callee’s device, tapping on Missed Call Notification or opening the app after the caller ended the call, I see for a couple of seconds the native incoming call screen and I expect not to.
Expected result: see a message in the chat: Missed call from John.

Thanks!

@Robert_Havrisciuc
Could you take a look at this sample branch and this file? This branch includes specific logic for handling remote push notifications.

The reason that you see the native incoming call screen is because SendBirdDelegate.didStartRinging is called right before DirectCall.didEnd is called when you receive a missed call notification. To avoid showing this extra call screen, you can check if the call has already ended by accessing directCall.isEnded flag.

Thanks :slight_smile:

@mininny
Still happening. Looked over the branch and that file and I have the exact implementation but still the missed call is fired and it shouldn’t. Guess the call is not ended if directCall.isEnded is false.

Thanks :slight_smile:

@Robert_Havrisciuc Hi, if the problem is still persisting, could you please show how you implemented the code handling the Remote Push Notification and SendBirdCallDelegate.didStartRinging? It would greatly help us identify the issue here.

Thanks!

Hi @mininny Thanks for getting back to me. Sure, I’ll attach two screenshots below.

1 Like

Hi @Robert_Havrisciuc. I have tested using the exact same code you provided, but I was not able to reproduce the issue that you reported. I’m not really sure what’s happening here, but the issue you said should not be happening.

By any chance, do you have any code for VoIP Push Notifications in your app, or have remaining VoIP Push Certificates in the SendBird Dashboard?

We will further discuss about this issue internally tomorrow. Thanks :slight_smile:

Hi @mininny

No, I removed any code related to VoIP Push Notifications and in SendBird Dashboard I have only APNs Certificates. The issue is still occurring.

Some notes that might help us fix this issue:

  • I have both “Voice over IP” and “Remote notifications” selected in Background Modes.
  • After the user’s authentication has been completed, I call the SendBirdCall.registerRemotePush() method with the deviceToken. Here I don’t understand why you’re using on sample app the SendBirdCall.registerVoIPPush() method when you don’t set any value for UserDefaults.standard.voipPushToken.

Other than that don’t think what is wrong on my side, since I’ve followed the documentation and your sample app on branch feature/remote-push-notifications.

Appreciate your help!

Hi @Robert_Havrisciuc, thanks for the note.

I did notice that the code on the branch feature/remote-push-notifications contained wrong code, so I reviewed and fixed them yesterday. If you’re calling registerRemotePush() there, your implementation would be correct.

To clarify, is this what you’re experiencing?

Receive Incoming Remote push notification → Call ends 
→ Receive missed call notification → Click the notification to open the application 
→ CallKit screen appears for a couple of seconds 

Could you please check if the CallKit is being invoked in SendBirdCallDelegate.didStartRinging or could it be invoked somewhere else?

The situation you described usually appears when you report an incoming call to CallKit and immediately end the same call. This is done to resolve any VoIP Push Notifications because they always have to report an incoming call, but shouldn’t happen in this case with remote push notification. Can you please check if code similar to above could be ran by any chance?

Thanks!

Hi @mininny

Yes, those are the exact repro steps:
Receive Incoming Remote push notification → Call ends
→ Receive missed call notification → Click the notification to open the application
→ CallKit screen appears for a couple of seconds

I’m not sure why, it’s a bit weird. Following the exact steps above, the SendBirdCallDelegate.didStartRinging() is not invoked all the time, therefore there are cases, quite a few where it’s working as expected, no CallKit screen fired.

Based on what you said, I tried to figure out if it’s related to the duration of the call. Tried 5 scenarios to end the call after 1, 2, 3, 4, 5 seconds thinking this is it. But unfortunately it is not.
Since this issue is not reproducing all the time, I can’t address this as a bug related to the call duration before you end it, let’s say 2 or 10 seconds.

Note: somehow though, can’t reproduce it anymore, it entered twice in the same call, in the SendBirdCallDelegate.didStartRinging() where first call.isEnded was true, then call.isEnded was false. Hope this note might help.

Cheers!

Hi @Robert_Havrisciuc,

Thank you so much for such a detailed response.
It is odd that it’s showing inconsistent behavior… Would you be able to identify which code is invoking the CallKit’s incoming call screen? Some information about where and which code is reporting an invalid call to CallKit would greatly help us here!

You could look for CXCallManager.shared.reportIncomingCall and maybe put a log there. Appreciate the help!

Thanks :slight_smile:

Hi @mininny,

As in the screenshots sent above, the CXCallManager.shared.reportIncomingCall is invoked only in SendBirdCallDelegate.didStartRinging(). Exactly, here

The thing is the call is not ended. That’s what I’m thinking of, because it passes the
guard call.isEnded == false { return }. The call should be ended in this scenario.

Hi @Robert_Havrisciuc,

I and other engineers have been trying to replicate the issue you described over the past few days, but we were not able to. I’m not sure why there is a difference between your app and ours.

Would it be possible for you to record a video of the issue happening, and could you please check if the problem is present on our QuickStart Sample itself?

Hi @mininny,

Appreciate the effort you put in to reproduce and fix this issue.

Here you have a video recording of this issue, iOS 14.
Note: when tapping on the Missed Call Push Notification, the native Incoming Call screen is not fired just for 1-2 seconds as happened before, not it’s ringing as a normal call. I have to manually tap on end call button to end the call.

Also, couldn’t login in on QuickStart Sample /feature/remote-push-notifications. I entered the APP ID’s in AppDelegate, and create 2 users in Sendbird dashboard, one for caller and one for callee, with “Issue access token” checked. But I get an error message: “Failed to authenticate. Access token is not valid”.
Note: Tried to sign in with QR code but I don’t find a QR code in the Calls Studio of the SendBird Dashboard.

Thanks for your help! :slight_smile:

Hi @Robert_Havrisciuc,

Regarding your issue with authentication,

You can find sign in with QR code button in “Mobile apps” in the Calls Studio of the Sendbird dashboard.
Unfortunately, the QuickStart app doesn’t support authenticating with an access token if you have manually configured the App ID from AppDelegate, That’s why the app said “Failed to authenticate. Access token is not valid”.

Currently, I recommend that you don’t configure your App ID in AppDelegate to sign in with access token. You will see a button named “Sign in manually”. In there, you’ll see textfields for App ID, user ID, and access token.

Thanks