GetStream / stream-video-flutter

Flutter Video SDK - Build your own video app experience using Dart, Flutter and the Stream Video Messaging API.
https://getstream.io/video/docs/flutter/
Other
47 stars 22 forks source link

VoIP Push Notifications Not Working with APNS Certificate #781

Closed koraxis closed 1 week ago

koraxis commented 2 weeks ago

Hello,

I’ve been trying to get the ringing functionality to work in my app using VoIP push notifications, following the steps from the Stream documentation for APNS integration

I’ve created the iOS certificate for push notifications multiple times, following the instructions exactly, and configured everything as required. But, I still don’t receive the ringing or CallKit notifications.

When I test the push notification setup (apn2) in the Stream dashboard, I get this error:

{
    "device_errors": {
        "B4E8724720F7695B35E3802A241E8612D4A2FC18C36ADA429762F36399AD20EF": {
            "provider": "apn",
            "provider_name": "apn2",
            "error_message": "publishing the message failed. code = \"403\"; error = \"MissingProviderToken\""
        }
    },
    "rendered_message": {
        "channel_id": "fun-1",
        "cid": "mesagging:fun-1",
        "receiver_id": "audio-video-user-3",
        "type": "message.new",
        "message_id": "very-fake-message",
        "id": "very-fake-message",
        "channel_type": "messaging",
        "sender": "stream.chat",
        "version": "v2"
    },
    "duration": "62.87ms"
}

On the other hand, If I use an APNS configuration with just the Key ID, Team ID, Bundle ID, and APN .p8 keyfile (apn1), the normal push notifications work (attached image), but this setup doesn’t support VoIP.

image

As I mentioned, I’ve tried recreating the APNS certificate multiple times, but I keep running into the same issue. Any ideas on what might be causing this or what I could try to fix it? I’d really appreciate any help or suggestions!

Thanks!

deven98 commented 2 weeks ago

Hey @koraxis

At the moment, you cannot test VoIP notifications from the dashboard. Your push provider setup looks fine and I would recommend starting a ringing call from another device to test if this works.

deven98 commented 2 weeks ago

Creating a ringing call:

await call.getOrCreate(memberIds: ['user1_id', 'user2_id'], ringing: true, video: true);

koraxis commented 2 weeks ago

Creating a ringing call:

await call.getOrCreate(memberIds: ['user1_id', 'user2_id'], ringing: true, video: true);

So, for Android, the VoIP/Ringing notifications are working fine. The issue is with iOS—the receiver isn’t getting the VoIP notifications. Basically, with the apn1 (Created via APNS Keyfile, showing "Remote Only" on dashboard) configuration, I get a normal push notification on iOS when the other side calls with ringing:true. But when I switch to the apn2 (Created using APNS .p12 certificate , showing "Remote Notifications" and "VoIP Notifications" on dashboard) configuration, the iOS client doesn’t get anything at all.

deven98 commented 1 week ago

@koraxis Can you please use getDevices() on the video client and paste the list here?

koraxis commented 1 week ago

We found the issue! The problem was that we were testing the iOS version on a real device without an eSIM or SIM card, so there was no cellular connection. It turns out that for VoIP notifications to work with CallKit, iOS requires an active cellular connection. Without it, the device defaults to standard push notifications instead of VoIP. We were not aware of this before