hoxfon / react-native-twilio-programmable-voice

React Native wrapper for Twilio Programmable Voice SDK
MIT License
182 stars 154 forks source link

deviceNotReady error : "Registration failed" #148

Closed ArchanaSharma95 closed 4 years ago

ArchanaSharma95 commented 4 years ago

I have done server setup in php. But getting "Registration failed" error in 'deviceNotReady" listener. This is a function I am calling on click of number:

initTwilio = async () => {
    const token = await this.getAuthToken();
    if (Platform.OS === 'android') {
        await this.getMicrophonePermission();
    }
    const success = await TwilioVoice.initWithToken(token);
    if (success.initialized) {
        TwilioVoice.addEventListener('deviceReady', () => {
            this.setState({ twilioInited: true });
        });
        TwilioVoice.addEventListener('deviceNotReady', function (data) {
            console.log('data', data) // getting error here
        });
        if (Platform.OS === 'ios') { //required for ios
            TwilioVoice.configureCallKit({
                appName: 'ReactNativeTwilioExampleApp',
            });
        }
    }
};

getAuthToken = () => {
    return fetch('https://myurl/accessToken.php', {
        method: 'get',
    })
    .then(response => response.text())
    .catch((error) => console.error(error));
}

Please help I am new to this.

walosha commented 4 years ago

You probably made a typo when setting up the twillo key on the backend. This particular happened to me when I couldn't generate the API secret and API secret key well. I hope it helps

pruthvirajkarur commented 4 years ago

@ArchanaSharma95 Were you able to get the solution. I am also facing same issue. err: "Registration failed" getting this response in deviceNotReady event listner

jdegger commented 4 years ago

Hi, 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.