Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple failed push credential requests per call. #65

Closed
jheyer159 opened this issue Jan 25, 2018 · 3 comments
Closed

Multiple failed push credential requests per call. #65

jheyer159 opened this issue Jan 25, 2018 · 3 comments
Labels

Comments

@jheyer159
Copy link

jheyer159 commented Jan 25, 2018

Please include following information for better support

What version of React Native are you running? 0.51.0
What version of react-native-twilio-programmable-voice are you running? 3.10.0
What device are you using? (e.g iOS9 simulator, Android 6 device)? Simulator ios10, ios10, android device 6.0.1
Is your app running in foreground, background or not running? App is in foreground.
Is there any relevant message in the log? I'm not sure what's relevant yet.
If using iOS, which pod version are you using? 2.0.0

Step to reproduce
Call from iOS device to Android device.

Advanced:
Have you tried adding break point in native handlers and see the logs printed? Yes, but I'm not sure what's relevant.
can share a project with issue? Not really.
Did you try to reinstall the pods completely? Yes, I've done this more times than I can count.

screen shot 2018-01-24 at 5 59 22 pm

I'm seeing multiple (5+) failed requests in the Twilio debugger when only one call is initiated.
screen shot 2018-01-24 at 5 58 52 pm
It's only empty when I call from iOS to Android. Android to iOS doesn't trigger the empty credential errors. iOS simulator to iOS device doesn't trigger it either. I'm now testing calls between real devices because the simulator seems to crash a lot and not accept incoming calls. Everything is client to client connection.

This is what I see in the call log. One call results in an incoming call from the initial client, then the Twiml results in an outgoing dial that connects both clients.
screen shot 2018-01-24 at 5 57 43 pm

My guess is that old tokens are being triggered because I've deleted those credentials that are missing and the server isn't serving those tokens anymore. I've restarted the Node server many times.

I'm attempting to use VoIP Push Notifications to handle the incoming connection. I've yet to see a notification on iOS. I see the didReceiveIncomingPushWithPayload get triggered, but no notification appears, and I don't see any errors. Android notifications work fine.

I tried downgrading to 2.0.0-beta15, but my Android notifications stopped working. I don't know where else to look to make this work properly.

I have two server routes to deliver push tokens for iOS and Android. I was planning to add token storage in React Native and handle the refresh check there, but I wanted to solve this problem first.

My client JS looks like this... it used to be identical to the recommended docs, but that was causing me issues, and this seems to be working - for the most part.

async function initTelephony(uid) {
    try {
        const url = `${TWILIO_APP_URL}/accessToken?identity=${encodeURIComponent(uid)}&platform=${encodeURIComponent(platform)}`
        const request = new Request(url)
        const accessToken = await getAccessTokenFromServer(url)
        TwilioVoice.initWithToken(accessToken)

        if (Platform.OS === IOS){ 
            TwilioVoice.configureCallKit({
                appName:       'appname',                  // Required param
                imageName:     '',             // OPTIONAL
                ringtoneSound: '' // OPTIONAL
            })
        }
        else {
            requestMicrophonePermission() //this goes to React Native Android permissions
        }
        
    } catch (err) {
        console.log("init error: ", err)
    }
}

Here's the express path that Node is delivering.

(req, res) => {

        var resp = new VoiceResponse()
        const dial = resp.dial()
        res.writeHead(200, {
          'Content-Type':'text/xml'
        });
        dial.client({},req.body.To)
        res.end( resp.toString() )

Sometimes when a call connects I hear nothing but a loud noise - dunno if this is relevant or what to do about it besides initiate a new call.

  • Do iOS notifications work? I don't see any errors in Xcode or any notifications. I tried setting this up with a fresh CSR.
  • Should I be using initWithTokenUrl on iOS? It's my understanding that initWithToken should be the same cross platform.
  • Do I need to clear old tokens somewhere?
  • Where / How can I further debug the multiple failed notification requests?
@jheyer159 jheyer159 changed the title Multiple failed credential requests per call. Multiple failed push credential requests per call. Jan 25, 2018
@fabriziomoscon
Copy link
Collaborator

fabriziomoscon commented Feb 8, 2018

@jheyer159 Thanks for filling in such a detailed issue. My apologies for not replying to this earlier!
Calling PSTN from iOS leaves Empty Credentials errors also for me, but the calls are delivered. I can also receive calls to the app.

Do iOS notifications work? I don't see any errors in Xcode or any notifications. I tried setting this up with a fresh CSR.

My understanding of iOS VOIP push notifications is that they are not normal APN notifications, in the way that you will need a special certificate in order to deliver them. Also you must configure debug = true to test on any app installed manually. Only Appstore and Testflight apps need debug=false.
Does this help? Also try to install Twilio official quickstart and see if the outcome is the same.

Should I be using initWithTokenUrl on iOS? It's my understanding that initWithToken should be the same cross platform.

They are equivalent

Do I need to clear old tokens somewhere?

I am not sure. Twilio might be able to answer this question.

Where / How can I further debug the multiple failed notification requests?

UPDATE:
I opened an issue against the Twilio repo and I am in contact with Bobie to try to fix this issue

  • Please clarify as a matrix of in/out call VOIP/real and ios/Android which calls are delivered for your installation and which aren't
    The loud noise is not common. But usually I deem testing calls on real device the only sensible thing to do.

I hope this was helpful and reach me with your findings.

@fabriziomoscon
Copy link
Collaborator

@jheyer159
I opened an issue against the Twilio repo and I am in contact with Bobie to try to fix this issue.
It seems that either old push credentials are used or there is a platform segregation problem when the same TwiML app is used on iOS and Android. Which most of times is the case while developing.

@jdegger
Copy link
Collaborator

jdegger commented Oct 27, 2020

We have discussed this issue with Twilio as well. They now remove credentials which are not valid anymore. This issue should be resolved.

Since a long time has passed I will be closing this issue. Read our repository update in #158. I invite you to reopen this issue when you still have problems so we can debug the problems together.

@jdegger jdegger closed this as completed Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants