Error when picking up call

Im trying to make a call from my react js app which use the javascript sdk v2.1.0 to my react native app which use react native sdk v2.1.0-beta6. but i keep getting this error when trying to render the Cometchat.callingcomponent once the other use pick up call, or when i made the call and the other user pick up.

TypeError: undefined is not an object. (ealuating T.CometChat.appSettings.getRegion)

Here’s the snippet of code where i try to render the callscreen

import { CometChat } from '@cometchat-pro/react-native-chat'
import { useSelector, useDispatch } from 'react-redux'
import React from 'react'
import { View, Platform, PermissionsAndroid } from 'react-native'

export default props => {
  const { activeCall } = props.navigation.state.params || {}
  console.log(activeCall)
  const [permission, setPermission] = React.useState(false)
  let settings = new CometChat
    .CallSettingsBuilder()
    .setSessionID(activeCall.sessionId)
    .enableDefaultLayout(true)
    .setCallEventListener(new CometChat.OngoingCallListener({
      onUserJoined: user => {
        console.tron.log('OngoingCallListener: User joined call:', user)
      },
      onUserLeft: user => {
        console.tron.log('OngoingCallListener: User left call:', user)
      },
      onCallEnded: call => {
        console.tron.log('OngoingCallListener: Call ended listener', call)
      },
    }))
    .build()

  React.useEffect(() => {
    async function getPermission() {
      const rationale = {
        title: 'Permission Required',
        message: 'Allow permission for better experience',
        buttonPositive: 'Allow',
        buttonNegative: 'Reject'
      }

      if(Platform.OS === 'android') {
        await PermissionsAndroid.requestMultiple([
          PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
          PermissionsAndroid.PERMISSIONS.CAMERA
        ]).then(res => {
          // console.log('===========gettting permission', res, PermissionsAndroid.RESULTS.GRANTED, Object.values(res).every(permission => permission === PermissionsAndroid.RESULTS.GRANTED))
          if(Object.values(res).every(permission => permission === PermissionsAndroid.RESULTS.GRANTED))
            setPermission(true)
          // console.log('==========got permission', [audioPermission, camPermission])
          // if(audioPermission === PermissionsAndroid.RESULTS.GRANTED && camPermission === PermissionsAndroid.RESULTS.GRANTED)
          //   this.permissionsGranted = true
        }).catch(error => console.log('error getting permissions', error))
      }
    }
    getPermission() 
  }, [])
  return (
    <View style={{height: '100%', width: '100%', position: 'relative'}}>
      {
        Platform.OS === 'android'
        ? permission && <CometChat.CallingComponent callsettings={settings} onFailure = {(e)=>{console.log('error', e);}} />
        : <CometChat.CallingComponent callsettings= {settings} onFailure = {(e)=>{console.log('error', e);}} />
      }
    </View>
   )
}

Hello @mike_van, We have stable ReactNative SDK v2.1.0. We recommend upgrading to the latest version.

Upgrading to the latest version should solve the issue you are facing.

Thank You

Hi thanks for the reply. I upgraded now and i get this error.

TypeError: I.CallController.getInstance().getCallListner()._eventListener.onError is not a function. (In 'I.CallController.getInstance().getCallListner()._eventListener.onError(new R.CometChatException(A.CALL_ERROR.NOT_INITIALIZED))', 'I.CallController.getInstance().getCallListner()._eventListener.onError' is undefined) This error is located at: in NavigationContainer (at Root.js:59) in Unknown (at App.js:79) in PersistGate (at App.js:78) in Provider (at App.js:77) in Root in RCTView (at AppContainer.js:101) in RCTView (at AppContainer.js:119) in AppContainer (at renderApplication.js:39)

appear to be some sort android permission error? cos i think i enabled the voice_audio and camera here. or is there anything else im missing?

Hello @mike_van,

Please add the onError callback in the setCallEventListener(). You can check the documentation here.
Also, it looks like CometChat is not initialized when you are trying to start a call. You can refer to our sample app here.

Warm Regards,

CometChat Pro
Mayur Bhandari