hoxfon / react-native-twilio-programmable-voice

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

Any listener like 'TwilioVoice.addEventListener('deviceReady') not working in IOS #218

Open skjangid opened 2 years ago

skjangid commented 2 years ago

Hello,

I am using react-native-twilio-programmable-voice for making a phone call, this is working fine in android but not working in IOS.

TwilioVoice.initWithToken is return true and after that i calling listeners but linterners alr noe calling in ios.

My code is :

import TwilioVoice from 'react-native-twilio-programmable-voice';

useEffect(() => { initTwilio() }, [])

const initTwilio = async () => {
    const tokenUrl = await getAuthUrlToken();
    const token = await getAuthToken(tokenUrl.twilio.json_access_token_url);
    await getMicrophonePermission();
    const resp = await TwilioVoice.initWithToken(token && token.token && token.token.toString());
    console.log('resp init token', resp);
    listeners();
    if (Platform.OS === 'ios') { //required for ios
        try {
          TwilioVoice.configureCallKit({
              appName: 'Materio',                  // Required param
          });
          console.log('CallKit Configured');
      } catch (err) {
        console.err('call kit error', err);
      }
    }
};

const listeners = () => { console.log('listeners'); TwilioVoice.addEventListener('deviceReady', () => { console.log('ready') });

    TwilioVoice.addEventListener('deviceNotReady', function (data) {
        console.log('data', data)
    })

    TwilioVoice.addEventListener('connectionDidDisconnect', (data) => {
        console.log('>> TwilioVoice, Call disconnect.', data);
    });

    TwilioVoice.addEventListener('connectionDidConnect', function (data) {
        setCallState('Connected')
    })

    TwilioVoice.addEventListener('connectionIsReconnecting', function (data) {
        console.log('connectionIsReconnecting', data)
    })

    TwilioVoice.addEventListener('connectionDidReconnect', function (data) {
        console.log('connectionDidReconnect', data)
    })

    TwilioVoice.addEventListener('callStateRinging', function (data) {
        console.log('callStateRinging', data)
    })
    TwilioVoice.addEventListener('callInviteCancelled', function (data) {
        console.log('callInviteCancelled', data)
     })

    TwilioVoice.addEventListener('deviceDidReceiveIncoming', function (data) {
        console.log('deviceDidReceiveIncoming', data)
    })

}

skjangid commented 2 years ago

Hello, You guys have any update for me ?

prerakd commented 2 years ago

Facing the same issue for react-native@0.67.2

saif482 commented 2 years ago

@prerakd is it fixed for you?

Nziranziza commented 2 years ago

Having similar issue as well

janandaraj commented 1 year ago

+1 same issue

culov commented 1 year ago

Same issue. Was working for years for me, but no longer works on iOS after upgrading to Xcode 14. Is this package dead now?