react-native-callkeep icon indicating copy to clipboard operation
react-native-callkeep copied to clipboard

IOS answerCall not firing when user is already on a call

Open patrickmburrus opened this issue 2 years ago • 2 comments

Bug report

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

  • Reproduced on:

  • [ ] Android

  • [ ] iOS

Description

We have everything working great, when the user isn't already on an active call... The normal flow is working, we send the notification, it rings the user's phone, and handles the events in 'didDisplayIncomingCall', 'didActivateAudioSession', 'answerCall', 'endCall', and 'didLoadWithEvents'. When a user is already on a phone call and receives our call notification, the 'didDisplayIncomingCall' fires as expected and the device rings. When they go to close current call and accept the incoming, the current call ends as expected, but we never got the 'answerCall' or 'didActivateAudioSession' events. (see logs below).

from our AppDelegate.m:

    [RNCallKeep setup:@{
        @"appName": @"weavix",
        @"imageName": @"weavix.png",
        @"ringtoneSound": @"weavix_ringtone.wav",
        @"includesCallsInRecents": @NO,
        @"maximumCallGroups": @"1"
      }];

...
      [RNCallKeep reportNewIncomingCall:callerId
                                 handle:callerId
                                 handleType:@"generic"
                                 hasVideo:NO
                                 localizedCallerName:callerName
                                 supportsHolding:YES
                                 supportsDTMF:YES
                                 supportsGrouping:YES
                                 supportsUngrouping:YES
                                 fromPushKit:YES
                                 payload:payload.dictionaryPayload
                                 withCompletionHandler:completion];

our listeners:

    RNCallKeep.addEventListener('didDisplayIncomingCall', ({ payload }) => {
        const pushPayload = payload as PushPayload;

        console.log('Did display call', pushPayload);
        const id = (pushPayload?.data as ChannelMessage)?.id;
        if (!id || calls[id]) return;
        calls[id] = pushPayload;
        scheduleMissedNotification(pushPayload);
    });
    RNCallKeep.addEventListener('didActivateAudioSession', () => {
        console.log('Did activate audio', pendingId);
        if (pendingId) answerCall(pendingId);
        pendingId = null;

        if (didActivateAudioSession) {
            didActivateAudioSession();
            didActivateAudioSession = null;
        }
    });
    RNCallKeep.addEventListener('answerCall', async ({ callUUID }) => {
        console.log('Call answer', callUUID);
        pendingId = callUUID;
        await sleep(5000);
        if (pendingId) answerCall(pendingId);
        pendingId = null;
    });
    RNCallKeep.addEventListener('endCall', ({ callUUID }) => {
        console.log('Call ended', callUUID);
        endCall(callUUID);
        if (didEndCall) {
            didEndCall();
        }
    });

    // Handle events fired in native code before JS bridge was ready.
    RNCallKeep.addEventListener('didLoadWithEvents', events => {
        console.log('DID LOAD WITH EVENTS', events);
        for (const { name, data } of events) {
            callKeepEmit(name, data);
        }
    });

Steps to Reproduce

Be on a call and send a notification to the RNCallKeep. Attempt to end and accept the incoming call.

Versions

- Callkeep: 4.3.9
- React Native: 0.67.5
- iOS: 16.5.1
- Android:
- Phone model: iPhone Xr

Logs

NOTE: call 64b5acc1-736f-4284-8d12-373a2a06d80a was handled successfully and ended succefully. We then initiated a call while on it, kicked off call ID 64b5ace5-10ee-4fc3-aef9-bc77e80a5b1b. It rang and we answered it. No events were fired.

2023-07-17 15:59:34.439830-0500 Weavix[2092:1266663] [RNCallKeep][setSettings] options = {
2023-07-17 15:59:34.439894-0500 Weavix[2092:1266663] [RNCallKeep][getProviderConfiguration]
2023-07-17 15:59:34.652728-0500 Weavix[2092:1266663] [RNCallKeep][init]
2023-07-17 15:59:39.520670-0500 Weavix[2092:1266972] [RNCallKeep][startObserving]
2023-07-17 16:04:02.525326-0500 Weavix[2092:1266663] RNCallKeep caller id ===> 64b5acc1-736f-4284-8d12-373a2a06d80a    callerNAme  ==> warning - 24
2023-07-17 16:04:02.525557-0500 Weavix[2092:1266663] [RNCallKeep][reportNewIncomingCall] uuidString = 64b5acc1-736f-4284-8d12-373a2a06d80a
2023-07-17 16:04:02.549712-0500 Weavix[2092:1266663] [[RNCallKeep]] sendEventWithNameWrapper: RNCallKeepDidDisplayIncomingCall, hasListeners : YES
2023-07-17 16:04:05.448097-0500 Weavix[2092:1266663] [RNCallKeep][CXProviderDelegate][provider:performAnswerCallAction]
2023-07-17 16:04:05.448461-0500 Weavix[2092:1266663] [RNCallKeep][configureAudioSession] Activating audio session
2023-07-17 16:04:05.452875-0500 Weavix[2092:1266663] [[RNCallKeep]] sendEventWithNameWrapper: RNCallKeepPerformAnswerCallAction, hasListeners : YES
2023-07-17 16:04:05.659031-0500 Weavix[2092:1266663] [RNCallKeep][CXProviderDelegate][provider:didActivateAudioSession]
2023-07-17 16:04:05.660211-0500 Weavix[2092:1266663] [RNCallKeep][configureAudioSession] Activating audio session
2023-07-17 16:04:05.696841-0500 Weavix[2092:1266663] [[RNCallKeep]] sendEventWithNameWrapper: RNCallKeepDidActivateAudioSession, hasListeners : YES
2023-07-17 16:04:08.201713-0500 Weavix[2092:1268352] [RNCallKeep][reportEndCallWithUUID] uuidString = 64b5acc1-736f-4284-8d12-373a2a06d80a reason = 2
2023-07-17 16:04:08.277863-0500 Weavix[2092:1266663] [RNCallKeep][CXProviderDelegate][provider:didDeactivateAudioSession]
2023-07-17 16:04:08.278007-0500 Weavix[2092:1266663] [[RNCallKeep]] sendEventWithNameWrapper: RNCallKeepDidDeactivateAudioSession, hasListeners : YES
2023-07-17 16:04:38.402069-0500 Weavix[2092:1266663] RNCallKeep caller id ===> 64b5ace5-10ee-4fc3-aef9-bc77e80a5b1b    callerNAme  ==> warning - 23
2023-07-17 16:04:38.402125-0500 Weavix[2092:1266663] [RNCallKeep][reportNewIncomingCall] uuidString = 64b5ace5-10ee-4fc3-aef9-bc77e80a5b1b
2023-07-17 16:04:38.410794-0500 Weavix[2092:1266663] [[RNCallKeep]] sendEventWithNameWrapper: RNCallKeepDidDisplayIncomingCall, hasListeners : YES
2023-07-17 16:04:50.424885-0500 Weavix[2092:1269131] [RNCallKeep][reportEndCallWithUUID] uuidString = 64b5ace5-10ee-4fc3-aef9-bc77e80a5b1b reason = 2

patrickmburrus avatar Jul 17 '23 22:07 patrickmburrus

is there any solution for this issue??

matthewadel avatar Jan 15 '24 23:01 matthewadel

I am facing the same issue, Any solutions yet ?

akshaya-rao-s avatar Mar 22 '24 10:03 akshaya-rao-s