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

How to simulate missed call when caller cancels a call?

Open
#383 4 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

This is not a bug but I did not know where to post my question?

I have used agora.io for call and firebase for voip push notifications.
react-native-callkeep : for showing incoming call when voip push notification is arrived.
Web RTC : agora.io
Firebase Firestore: for realtime database

my calls are successful when user accepts incoming call on IOS and android.
But when a user calls other user and it shown incoming call on IOS or Android and then caller cancels the call, how do I disconnect ?

Approach I tried is to create Firebase collection listener inside "RNCallKeep.addEventListener('didDisplayIncomingCall', (data) => {}" (I am using firebase database), but the issue is that it works for first time then for next calls the old listener works and does not get destroyed.

Any ideas are welcome.

My code sample for firestore document subscription when incoming call is displayed:

// RNCallKeep.addEventListener('didDisplayIncomingCall', (data) => {
// console.log('didDisplayIncomingCall', data);
// #TODO: search for ways to handle this case for missed calls
// callDataSubscription = currentCallRef.onSnapshot({
// error: (error => {
// console.log(error);
// }),
// next: (snap) => {
// const callData = snap.data();
// console.log('callData', callData)
// if (callData.cancelled === true || callData.missed === true || callData.disconnected === true) {
// RNCallKeep.endCall(data.callUUID);
// return;
// }
// }
// });
// setTimeout(() => {
// if (typeof callDataSubscription === 'function') {
// callDataSubscription()
// callDataSubscription = null;
// }
// // currentCallRef = null;
// }, 5000);
// });

Commented code is where I am ending call depending on what data is gets.
When caller cancels the call before callee accepts it the document will save "missed" and "disconnected" true.

Thank you in advance

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 with the reported RNCallKeep.addEventListener('didDisplayIncomingCall') flow and the Firestore onSnapshot subscription shown in the issue. Reproduce successive incoming calls with the caller cancelling before acceptance, then inspect how the subscription cleanup and RNCallKeep.endCall(data.callUUID) interact. Done means the cancelled or missed call is disconnected reliably without an old listener handling later calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
audio-video-rtc, mobile
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.