react-native-webrtc / react-native-webrtc/react-native-callkeep

NSInternalInconsistencyException: Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push.

Open
#664 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
511
Avg merge
9h 12m
Merged PRs (30d)
2

Description

Bug report

  • I've checked the example to reproduce the issue.

  • Reproduced on:

  • Android

  • iOS

Description

We are seeing some Crashlytic reports like this:

Fatal Exception: NSInternalInconsistencyException
Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push.

(full log below)

Here is the pushRegistry block in our AppDelegate.m

- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {
  NSString *uuid = @"unknown";
  NSString *handle = @"unknown";
  NSString *callerName = @"unknown";
  NSDictionary *extra;
  
  @try {
    [RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type];
    
    uuid = [[NSUUID UUID] UUIDString].lowercaseString;
    NSString *ani = [payload.dictionaryPayload valueForKeyPath:@"data.ani"];
    NSString *name = [payload.dictionaryPayload valueForKeyPath:@"data.callerName"];
    
    if (ani && [ani isKindOfClass:[NSString class]]) {
      handle = ani;
    }
    callerName = handle;
    if (name && [name isKindOfClass:[NSString class]]) {
      callerName = name;
    }
    extra = [payload.dictionaryPayload valueForKeyPath:@"data"];
    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
    [dateFormatter setLocale:enUSPOSIXLocale];
    [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];
    [dateFormatter setCalendar:[NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian]];

    NSDate *now = [NSDate date];
    NSString *iso8601String = [dateFormatter stringFromDate:now];
    [extra setValue:iso8601String forKey:@"notificationTime"];
  }
  @catch (NSException *exception) {}
  
  [RNCallKeep reportNewIncomingCall: uuid
                               handle: handle
                           handleType: @"number"
                             hasVideo: NO
                  localizedCallerName: callerName
                      supportsHolding: YES
                         supportsDTMF: YES
                     supportsGrouping: YES
                   supportsUngrouping: NO
                          fromPushKit: YES
                              payload: extra
                withCompletionHandler: completion];
}

Steps to Reproduce

We have not been able to reproduce. These reports are coming from the wild, and they seem to be very sparse.

Versions

- Callkeep: 4.3.6
- React Native: 0.66.3
- iOS: 16
- Android: N/A
- Phone model: 

Logs

Fatal Exception: NSInternalInconsistencyException
Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push.

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x9e48 __exceptionPreprocess
1  libobjc.A.dylib                0x178d8 objc_exception_throw
2  Foundation                     0x54594c _userInfoForFileAndLine
3  PushKit                        0x473c -[PKPushRegistry _terminateAppIfThereAreUnhandledVoIPPushes]
4  libdispatch.dylib              0x3fdc _dispatch_client_callout
5  libdispatch.dylib              0x13574 _dispatch_lane_barrier_sync_invoke_and_complete
6  PushKit                        0x3a54 __73-[PKPushRegistry voipPayloadReceived:mustPostCall:withCompletionHandler:]_block_invoke
7  libdispatch.dylib              0x24b4 _dispatch_call_block_and_release
8  libdispatch.dylib              0x3fdc _dispatch_client_callout
9  libdispatch.dylib              0x127f4 _dispatch_main_queue_drain
10 libdispatch.dylib              0x12444 _dispatch_main_queue_callback_4CF
11 CoreFoundation                 0x9a6d8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
12 CoreFoundation                 0x7c03c __CFRunLoopRun
13 CoreFoundation                 0x80ec0 CFRunLoopRunSpecific
14 GraphicsServices               0x1368 GSEventRunModal
15 UIKitCore                      0x3a186c -[UIApplication _run]
16 UIKitCore                      0x3a14d0 UIApplicationMain
17 net2phone                      0x5b40 main + 7 (main.m:7)
18 ???                            0x1bed76960 (Missing)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the AppDelegate.m pushRegistry callback shown in the report, then trace RNVoipPushNotificationManager and RNCallKeep reportNewIncomingCall using the linked example. Run the example or inspect the Crashlytics stack and verify the incoming-call path after a PushKit payload; done means the reported iOS termination path is reproduced or its cause is isolated.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c, react-native
Domain
audio-video-rtc, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.