Closed kjdfjhdjkh closed 9 months ago
Hi @kjdfjhdjkh the incoming call UX is under ongoing development. However, the notification at this point in time is handled entirely by the SDK and not the app implementing the SDK, when you tap on the accept or decline button in the notification you should actually be interacting with the call, the Reference App UI just won't reflect those actions (for now). Do you hear audio being passed between call participants after accepting the call? If not, what platform are you using? If you're on Android you can try adb logcat
, you should see some native logs referring to the Twilio Voice Android SDK.
I was able to accept calls from inside the app but how would I connect if I'm in the CallKit UI?
Hi @marcato15
When you accept a call in the CallKit UI (iOS native call UI), a CallKit framework callback will be fired inside the React Native SDK iOS layer. Assuming nothing went wrong, the application JS layer should get the CallInviteAccepted
event, where you should properly update the UI state of the app.
I see the logs from the app that it’s ringing but every time I tap accept on the native UI it immediately says call declined.
@marcato15
Who is saying call declined? the native UI or the SDK/app log? Also do you have a Twilio Call SID so we can at least take an initial look to rule out some immediate errors.
The Native UI is saying it (very briefly as it transitions to the app). I have provided 2 Call SID's:
Call Worked, accepted from within app: CA07a4ac30f8579d71e1d64899c1ed608f Call accepted from Native UI: CA90261f49d434eec2104ed1d2a189c7e4
Is there anything I need to setup in the app for it to accept native UI stuff? (knowing that I can answer calls inside the app). Right now when the app opens I check if there is a pending callInvite and navigate to the Phone screen which has the logic for accepting calls from within the app, but I would assume the iOS layer would need to have already connected the call before the app opens if a call is accepted via the native UI?
I have this in my apps bootstrap file, if it helps.
await voice.initializePushRegistry();
await voice.register(token);
voice.on(Voice.Event.CallInviteAccepted, callInvite => {
const callSid = callInvite.getCallSid();
console.log("call invite accepted");
navigate(Routes.PHONE, { callInvite, callSid });
});
voice.on(Voice.Event.CallInvite, callInvite => {
console.log("call invite pending");
navigate(Routes.PHONE, { callInvite });
});
Thanks for the Call SIDs @marcato15
From what I can see with the second SID, there seems to be two clients with the same identity (possibly on the same device?) that are receiving the call at the same time, and both of the mobile clients rejected the call soon after the they received the call invite.
Did the Voice.Event.CallInviteRejected
event get triggered when the call failed?
Also is it possible to build and run the app by opening the TwilioVoiceReactNativeReferenceApp.xcworkspace
(or whichever project name .xcworkspace it is). We can use the Xcode debugging log for further diagnosis.
So, I was able to finally accept calls through the native UI. I think the issue that I'm running into is that if I restart the app when running through expo dev server it seems to be registering a second device or something. Have to uninstall the app and reinstall it for it not to do what it did before. I'm calling this every time the app loads, is that a problem?
const voice = new Voice();
await voice.initializePushRegistry();
await voice.register(token);
Also, I know these tokens are short lived. What happens if they expire? While it still ring the device? And if the app is closed will it awake from sleep? I'm trying to figure out if the app can ring if someone logs in then hasn't been logged in once then closes the app for a few days.
Glad that you are able to accept the calls from the native UI now.
Ideally you don't have to call the register()
method every time at launch, but invoking the initializePushRegistry()
method is required if the application wants the SDK to handle the incoming call push notifications and the CallKit (native UI) events for you.
About the token expiry - as long as the token is valid (has not expired) and can be used for authentication at the time when the application calls the Voice.register()
method or the Voice.connect()
method then you are good to go. The application will still be able to receive incoming call push notifications unless explicitly unregistered regardless of app state, backgrounded or terminated.
So the application could ring even if it was registered with an expired token and before it connects it could call the backend and get a new token and then connect the call?
Yes, the token needs to be valid and has not expired when performing the registration or connecting the call.
Thanks. And just to confirm on the register()
call, that really only
needs to happen once per device, correct? I'm wondering if calling that
multiple times is what is causing there to be multiple instances of the
call.
On Wed, Sep 27, 2023 at 1:33 PM bobiechen-twilio @.***> wrote:
Yes, the token needs to be valid and has not expired when performing the registration or connecting the call.
— Reply to this email directly, view it on GitHub https://github.com/twilio/twilio-voice-react-native-app/issues/81#issuecomment-1737890005, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADE6773VPERJ2YURFVVNQTX4RWOJANCNFSM6AAAAAAZ7IQW64 . You are receiving this because you were mentioned.Message ID: @.***>
-- Marc Tanis
This is a good question - Twilio will manage the push notification binding for you in this case and refresh the binding information so that only one client instance is registered for this app on this device. Only one incoming call will be received. That being said there could still be a way to receive multiple calls on the same device, which is under the same Twilio account you registered the same identity but under different VoIP cert or different Push Credential.
Hi all, I'm closing this issue now. The reference app supports incoming and outgoing calls.
Hello!
Is this reference app able to accept calls?
I have this reference app built and on the phone, and it looks like there are files within the /src directory that correspond to accepting call invites. I have Firebase set up and pointing to a specific identity for the token that the phone is using, and when I ping the place-call Twilio Serverless function I have set up from the voice quickstart, it gives me the notification on the phone that the identity is being called, but neither the green Answer button nor the Decline button in the notification do anything when tapped.
The reference app is built without any modifications except the .env file modifications and the /src/store/voice/accessToken.ts has the fetchResult constant url modified to point to the specific Twilio Serverless function page.
I realize I've asked quite a few unanswerable questions, mostly which have been sorta due to me trying to figure out all of this stuff as I go, and I apologize for bugging you guys so much lol
Is there any way to test if tapping either of those buttons is doing anything under the surface? I would imagine that'd be the most sensible place for me to start troubleshooting, but I'm not entirely sure.