datso / react-native-pjsip

A PJSIP module for React Native.
http://datso.github.io/react-native-pjsip
GNU General Public License v3.0
273 stars 232 forks source link

Calling Start Method on Endpoint returns "Undefined is not an object " #65

Closed herlarb closed 6 years ago

herlarb commented 6 years ago

@datso am trying to follow the instructions provided to use the PJSIP library but anytime i invoke the .start() method on the endpoint instance i get an error " undefined is not an object (evaluating '_reactNative.NativeModules.PjSipModule.start')"

Here is my source code


import React , {Component} from 'react';
import {View, Text, Platform} from 'react-native'
import {Endpoint } from 'react-native-pjsip'
import {extendObservable} from 'mobx';
import {observer} from 'mobx-react'

class EndpointStart  extends Component{
    constructor(props){
        super(props);
        extendObservable(this,{
            endpoint : new Endpoint(),
            state:{}
        }
        );
    }

    componentWillMount(){
        this._onStart();
    }

    _onStart = async()=>{
        try{
            console.warn(this.endpoint);
        this.state = await this.endpoint.start();
    }catch(err){
        console.warn('',err.message);
    }
    }

    render(){
        const {endpoint} = this;
        return <Text>Test </Text>
    }
};

export default (observer(EndpointStart));
datso commented 6 years ago

Hi, what "react-native link" shows?

herlarb commented 6 years ago

I had not previously linked my the library ( my bad ) but upon linking all i get now is an empty object on state after calling .start() on endpoint instance . I am not conversant with redux only mobx but the sample app uses a lot of dispatch and redux . How can i get the access state information such as Calls , Accounts , Connectivity. I am quite new to the library. Kindly help

datso commented 6 years ago

Create a new account and then refresh the view on Android, this.state in your case shouldn't be empty.

DastoBuniq commented 3 years ago

Hi!, I'm using ios and after the appropriate setup procedure it comes up that NativeModules.PjSipModule (row72) in Endpoint.js is undefined. Help!!