Skip to content
This repository has been archived by the owner on May 26, 2019. It is now read-only.

Callkit view doesn't close #3

Open
siemya opened this issue Mar 8, 2017 · 20 comments
Open

Callkit view doesn't close #3

siemya opened this issue Mar 8, 2017 · 20 comments

Comments

@siemya
Copy link

siemya commented Mar 8, 2017

@ianlin Hey,

When i call the RNCallKit.endCall(this.uuid) function callkit view does not close.

Thanks for the module btw! 👍

@ianlin
Copy link
Member

ianlin commented Mar 9, 2017

Hey @siemya,

Are you testing on the incoming calls or outgoing calls? The system UI is appeared only for incoming calls while endCall() method is used for outgoing calls.

For incoming calls, when you press the hangup button from the system UI, there is an endCall event (different from endCall() method) sent to JS and the module will call [action fulfill] automatically. The system UI will be closed after this.

Can you provide more information about your scenario and some logs could be helpful.

@siemya
Copy link
Author

siemya commented Mar 9, 2017

Thanks for the fast response!

When the app is n foreground and i receive a call, i call the RNCallKit.displayIncomingCall function which opens the system UI.

And if i accept that call the system UI goes to background automatically, and i show my own callView.

When the user presses the endCall button or if i receive an endCall event from the other user, i close my own view and call the RNCallKit.endCall(this.uuid) function.

However the system UI keeps appearing on the background...

Thanks.

@ianlin
Copy link
Member

ianlin commented Mar 10, 2017

I think it happens when the uuid for displayIncomingCall() and endCall() are different. Can you verify your uuid?

@siemya
Copy link
Author

siemya commented Mar 11, 2017

@ianlin when i receive a remote call i set a uuid and display the call, and when i receive a remote hangup, i call the endCall event with the same uuid, but the ui doesn't close.

remoteCall() {
  this.uuid = uuid.v4();
  console.log(this.uuid); //a61405bc-252a-4057-b79e-5e971cc82688
  RNCallKit.displayIncomingCall(this.uuid, name);
}

hangUp() {
  console.log(this.uuid); //a61405bc-252a-4057-b79e-5e971cc82688
  RNCallKit.endCall(this.uuid);
  this.uuid = null;
}

@ianlin
Copy link
Member

ianlin commented Mar 13, 2017

That's odd, I've only run into this problem when the uuid is not the same. Can you please provide any log (JS and Native) to see what happened there?

@siemya
Copy link
Author

siemya commented Mar 13, 2017

Hey,

i guess i found the problem, but it still doesn't work sometimes.

On my constructor i add the endCall event listener, and i have two hangup functions (hangUp, remoteHangUp).

İ make a call when the app is on foreground, and end the call immediately. So i expect only the remoteHangUp function to get called. However after remoteHangUp also hangUp function gets called which i added to eventListener, which might mix things up.

//i expect to call hangUp only when user presses the decline button.
RNCallKit.addEventListener('endCall', this.hangUp);

remoteHangUp() {
  RNCallKit.endCall(this.uuid);
  //other actions
}

hangUp() {
  RNCallKit.endCall(this.uuid);
  //other actions
}

@ianlin
Copy link
Member

ianlin commented Mar 14, 2017

Had some tests and yes the endCall event will be triggered after every endCall action. But still I can't reproduce the problem you have even if I call RNCallKit.endCall() twice.

Instead of calling RNCallKit.endCall() in both of your hangup function, I would suggest put it in the signal event. For my case since I'm using SIP for signalling, I call it when terminated or cancel events received.

@ianlin
Copy link
Member

ianlin commented Mar 24, 2017

Hey @siemya have you sorted out this problem?

@eugenehp eugenehp mentioned this issue May 3, 2017
@eugenehp
Copy link

eugenehp commented May 3, 2017

@ianlin looks like there was a wrong UUID pointer. Now it works for me 👍

@joshuaalpuerto
Copy link

does anyone fixed this issue? Im having trouble calling endCall method

here's the code :

const _uuid = uuid.v4()

RNCallKit.displayIncomingCall(_uuid, "Translator") // <--- 2d506a4a-8c50-40cc-894c-c359c210fd74

setTimeout(() => {
      if (!_answered) {
        console.tron.log('should end call / missed call')
        console.tron.log({
          uuid: this._uuid // <--- 2d506a4a-8c50-40cc-894c-c359c210fd74
        })
        RNCallKit.endCall(_uuid)
      }
}, 10000)

Here's my log:

2017-07-10 11:00:55.572985+0800 TranslatorApp[2806:1089269] [RNCallKit][endCall] uuidString = 2d506a4a-8c50-40cc-894c-c359c210fd74
2017-07-10 11:00:55.573421+0800 TranslatorApp[2806:1089269] [RNCallKit][requestTransaction] transaction = <CXTransaction 0x181bdd30 UUID=C6AD163D-E00B-46EC-9E2A-C54FACE4E97B isComplete=0 actions=(
    "<CXEndCallAction 0x16fd0040 UUID=893A8730-1118-48CC-A60A-6E56FF1FFD30 state=0 commitDate=(null) callUUID=2D506A4A-8C50-40CC-894C-C359C210FD74 dateEnded=(null)>"
)>
2017-07-10 11:00:55.580380+0800 TranslatorApp[2806:1089398] [RNCallKit][requestTransaction] Error requesting transaction ((
    "<CXEndCallAction 0x16fd0040 UUID=893A8730-1118-48CC-A60A-6E56FF1FFD30 state=0 commitDate=(null) callUUID=2D506A4A-8C50-40CC-894C-C359C210FD74 dateEnded=(null)>"
)): (Error Domain=com.apple.CallKit.error.requesttransaction Code=4 "(null)")
2017-07-10 11:01:26.675633+0800 TranslatorApp[2806:1085467] [RNCallKit][CXProviderDelegate][provider:performEndCallAction]

Cheers!

@eugenehp
Copy link

eugenehp commented Jul 10, 2017 via email

@joshuaalpuerto
Copy link

joshuaalpuerto commented Jul 10, 2017

HI @eugenehp

Yes I am. I actually thought I edited my post but your PR, solves my issue.

@eugenehp
Copy link

@joshuaalpuerto glad it helped you.

I'm still curious to hear what @ianlin thinks about improving architecture of the wrapper.

@joshuaalpuerto
Copy link

joshuaalpuerto commented Jul 11, 2017

@eugenehp Sorry Im still new with mobile development, Im no expert of swift nor objective-c so I can't really comment on that. Anyway I experience a weird issue last night, Im trying to call endCall method and it is not triggering. I think it has something to do if the call goes wrong or something.

I have to put back this part on ios/RNCallKit/RNCallKit.m

+reportCallWithUUID:startCallAction.callUUID updated:callUpdate];
-reportCallWithUUID:startCallAction.UUID updated:callUpdate];

And It works again.

@joshuaalpuerto
Copy link

Hi @eugenehp ,

Im still encountering issue triggering endCall method.

Here is my Xcode's log:

RNCallKit][requestTransaction] Error requesting transaction ((
    "<CXEndCallAction 0x19f69cc0 UUID=FC02B203-768E-4179-8415-6021F7990C5C state=0 commitDate=(null) callUUID=612A5D2B-A337-41D4-9CA6-5EF0B656391D dateEnded=(null)>"
)): (Error Domain=com.apple.CallKit.error.requesttransaction Code=4 "(null)")

Im sure that this is what i registered with my displayIncomingCall: 612A5D2B-A337-41D4-9CA6-5EF0B656391D

Cheers!

@talibasya
Copy link

@joshuaalpuerto I noticed different behaviour on production and development version. In some cases endCall doesn't work properly on development deployment, but with production I don't have problems. Did you run app on prod version?

@joshuaalpuerto
Copy link

@talibasya Yes I run it with production build but still has issues. I think the problem is if the call was not established correctly.

@vyshkant
Copy link

vyshkant commented Jul 30, 2018

@joshuaalpuerto have you finally solved the problem?

@vyshkant
Copy link

The system UI is appeared only for incoming calls while endCall() method is used for outgoing calls.

@ianlin And what is the proper way to hide the incoming call screen when the call is terminated "from the other side" (i.e. the red button wasn't pressed by the user).

2018-07-30 19:57:31.461329+0300 MyProject[875:3717380] [RNCallKit][displayIncomingCall] uuidString = fcf1ad00-e4ae-48ef-a6be-0ced08209373

2018-07-30 19:57:38.971502+0300 MyProject[875:3722596] [RNCallKit][endCall] uuidString = fcf1ad00-e4ae-48ef-a6be-0ced08209373
2018-07-30 19:57:38.972359+0300 MyProject[875:3722596] [RNCallKit][requestTransaction] transaction = <CXTransaction 0x125e352c0 UUID=D0CA94B2-5888-4029-8BE7-11B3A02BB2A1 isComplete=0 actions=(
    "<CXEndCallAction 0x125e0aa60 UUID=37C172A4-5FC3-4775-A0D1-EA7BE33F3957 state=0 commitDate=(null) callUUID=FCF1AD00-E4AE-48EF-A6BE-0CED08209373 dateEnded=(null)>"
)>

2018-07-30 19:57:38.996998+0300 MyProject[875:3722596] [RNCallKit][requestTransaction] Error requesting transaction ((
    "<CXEndCallAction 0x125e0aa60 UUID=37C172A4-5FC3-4775-A0D1-EA7BE33F3957 state=0 commitDate=(null) callUUID=FCF1AD00-E4AE-48EF-A6BE-0CED08209373 dateEnded=(null)>"
)): (Error Domain=com.apple.CallKit.error.requesttransaction Code=4 "(null)")

So I have the same problem: the incoming call screen is not closed when I invoke RNCallKit.endCall. The only difference between these uuids is the case (I generate lowercased uuid).

@bmp123
Copy link

bmp123 commented Dec 12, 2018

I have same issue. app received call then open displayIncomingCall . if app go to background and app receive event end call from server - displayIcomingCall UI works, but app invoke endCall function

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants