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

Voip Notification callInviteEvent doesn't match #3896

Closed
JaspreetiOSDev opened this issue Dec 24, 2020 · 4 comments
Closed

Voip Notification callInviteEvent doesn't match #3896

JaspreetiOSDev opened this issue Dec 24, 2020 · 4 comments

Comments

@JaspreetiOSDev
Copy link

JaspreetiOSDev commented Dec 24, 2020

Hi Team,

We are getting voip notification with this method

  • (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion

and getting follwing payload in this:-

{ 
  aps =     {
  alert =         {
    "loc-args" =             (
        "Vishal Sharma"
    );
    "loc-key" = "VOICE_CALL_FROM_USER";
 };
badge = 2;
"content-available" = 1;
"mutable-content" = 1;
sound = default;
 };
 "event_id" = "$kITxGvu8t4TSqqGrCq_quQNR9NjNdKl3RBoSW0AIJJM";
 "room_id" = "!zHbtbcHEzENzIZrAqh:matrix.hakase-labs.io";
 ```
 }

Why my event id doesn't match every time. and printing following line in console:-

 "[PushNotificationService] didReceiveIncomingPushWithPayload: iOS 13 and in bg, but we don't have the last       callInvite event for the event "

this condition false every time

             if ([lastCallInvite.eventId isEqualToString:eventId])
           {
            [session.callManager handleCallEvent:lastCallInvite];
            MXCall *call = [session.callManager callWithCallId:lastCallInvite.content[@"call_id"]];
            if (call)
            {
                [session.callManager.callKitAdapter reportIncomingCall:call];
                NSLog(@"[PushNotificationService] didReceiveIncomingPushWithPayload: Reporting new call in room %@ for the event: %@", roomId, eventId);

                //  After reporting the call, we can continue async. Launch a background sync to handle call answers/declines on other devices of the user.
                [self launchBackgroundSync];
            }
            else
            {
                NSLog(@"[PushNotificationService] didReceiveIncomingPushWithPayload: Error on call object on room %@ for the event: %@", roomId, eventId);
            }
        }

@ismailgulek @SBiOSoftWhare @gileluard @aaronraimist @manuroe

@barpaw
Copy link
Contributor

barpaw commented Jan 12, 2021

This bug caused app termination and ghost voip call screen after reopening the app.

2021-01-11 14:44:41.072 Riot[6550:3401308] [PushNotificationService] didReceiveIncomingPushWithPayload: iOS 13 and in bg, but we don't have the last callInvite event for the event $deleted. There is something wrong.
2021-01-11 14:44:41.072 Riot[6550:3401308] Apps receving VoIP pushes must post an incoming call (via CallKit or IncomingCallNotifications) in the same run loop as   pushRegistry:didReceiveIncomingPushWithPayload:forType:[withCompletionHandler:] without delay.
2021-01-11 14:44:41.073 Riot[6550:3401308] *** Assertion failure in -[PKPushRegistry _terminateAppIfThereAreUnhandledVoIPPushes], PKPushRegistry.m:353
2021-01-11 14:44:41.073 Riot[6550:3401320] [UNUserNotificationCenter] removeCallNotifications: Removing 1 notifications.
2021-01-11 14:44:41.073 Riot[6550:3401308] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push callback.'
*** First throw call stack:
(deleted)
libc++abi.dylib: terminating with uncaught exception of type NSException

@ismailgulek @SBiOSoftWhare @gileluard @aaronraimist @manuroe

@toshanmugaraj
Copy link
Contributor

toshanmugaraj commented Jan 24, 2021

Its better call reportIncomingCall regardless of any failure, with error. Instead of crashing the app.

@manuroe manuroe mentioned this issue Apr 28, 2021
@ismailgulek
Copy link
Contributor

This should be fixed.

@ismailgulek
Copy link
Contributor

Hi Team,

We are getting voip notification with this method

  • (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion

and getting follwing payload in this:-

{ 
  aps =     {
  alert =         {
    "loc-args" =             (
        "Vishal Sharma"
    );
    "loc-key" = "VOICE_CALL_FROM_USER";
 };
badge = 2;
"content-available" = 1;
"mutable-content" = 1;
sound = default;
 };
 "event_id" = "$kITxGvu8t4TSqqGrCq_quQNR9NjNdKl3RBoSW0AIJJM";
 "room_id" = "!zHbtbcHEzENzIZrAqh:matrix.hakase-labs.io";

}


Why my event id doesn't match every time. and printing following line in console:-

"[PushNotificationService] didReceiveIncomingPushWithPayload: iOS 13 and in bg, but we don't have the last callInvite event for the event "


this condition false every time

         if ([lastCallInvite.eventId isEqualToString:eventId])
       {
        [session.callManager handleCallEvent:lastCallInvite];
        MXCall *call = [session.callManager callWithCallId:lastCallInvite.content[@"call_id"]];
        if (call)
        {
            [session.callManager.callKitAdapter reportIncomingCall:call];
            NSLog(@"[PushNotificationService] didReceiveIncomingPushWithPayload: Reporting new call in room %@ for the event: %@", roomId, eventId);

            //  After reporting the call, we can continue async. Launch a background sync to handle call answers/declines on other devices of the user.
            [self launchBackgroundSync];
        }
        else
        {
            NSLog(@"[PushNotificationService] didReceiveIncomingPushWithPayload: Error on call object on room %@ for the event: %@", roomId, eventId);
        }
    }

@ismailgulek @SBiOSoftWhare @gileluard @aaronraimist @manuroe

You cannot use VoIP pushes for messages anymore. See details: #2714

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants