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

How to end incoming call(Caller ends call before Callee accepts/picks the call)

Open nero2009 opened this issue 4 years ago • 6 comments

Bug report

  • Reproduced on:
  • [x ] Android

Description

Please I am trying to end an incoming call before the callee accepts/picks the call using callkeep. I saw some solutions in a github issue to :

  • Send another push notification that has a data property e.g isMissedCall then call Callkeep method RNCallKeep.reportEndCallWithUUID(uuid, reason); to end the call.The notifcation gets delivered but firebase OnMessageReceived is never called when the call is actively ringing.

  • Establish a connection to your server and then poll your server to check if the call has been rejected. I was able to implement this for IOS and it worked but on android when the call is actively ringing, I guess the javascript part of app does not run when it in the foreground(not sure the exact state but the app is open but not viewing it at that moment) so my setInterval I use to poll my server for the state of the call never runs.

The first solution didn't work on IOS/Android but the second one works only in IOS.

Please how can I end a call before calllee picks it?

Versions

- Callkeep:4.2.0
- React Native: 0.63.4
- Android: 11
- Phone model: S20 ultra

Logs

Paste here

nero2009 avatar Jul 26 '21 16:07 nero2009

@nero2009 did you find a solution?

linus-komnick avatar Aug 04 '21 14:08 linus-komnick

No I didn't.

nero2009 avatar Aug 04 '21 14:08 nero2009

@nero2009 I found out how to do it thanks to Romick2005's help. This is how I do it: When the call initiator cancels the call, I send a silent push notification to the callee. In AppDelegate I listen for this push notification and once it arrives, I terminate callkit like this: int reasonId = 6; [RNCallKeep endCallWithUUID: callId reason: reasonId];

linus-komnick avatar Aug 04 '21 21:08 linus-komnick

Great!! I will try this out. Please were you able to find a solution for android? @linus-komnick

nero2009 avatar Aug 05 '21 09:08 nero2009

@nero2009 I found out how to do it thanks to Romick2005's help. This is how I do it: When the call initiator cancels the call, I send a silent push notification to the callee. In AppDelegate I listen for this push notification and once it arrives, I terminate callkit like this: int reasonId = 6; [RNCallKeep endCallWithUUID: callId reason: reasonId];

Works perfectly.

yehyaumar avatar Dec 22 '21 06:12 yehyaumar

@nero2009 I found out how to do it thanks to Romick2005's help. This is how I do it: When the call initiator cancels the call, I send a silent push notification to the callee. In AppDelegate I listen for this push notification and once it arrives, I terminate callkit like this: int reasonId = 6; [RNCallKeep endCallWithUUID: callId reason: reasonId];

@linus-komnick could you paste your App Delegate on how to implement this. I am not very good in Objective C and this would be very helpful. Thank you so much in advance!

newme616 avatar Jul 15 '22 13:07 newme616