react-native-webrtc / react-native-webrtc/react-native-callkeep
IOS answerCall not firing when user is already on a call
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 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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with AppDelegate.m and the RNCallKeep setup/reportNewIncomingCall calls, then trace the native CallKit answer flow named in the logs: performAnswerCallAction, didActivateAudioSession, and their event forwarding. Reproduce the sequence while already on a call and compare it with the provided logs; done means answerCall and didActivateAudioSession reach the JavaScript listeners after the existing call ends.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, javascript, objective-c, react-native
- Domain
- audio-video-rtc, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100