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 233 forks source link

Cannot read property 'start' of undefined #15

Closed murugancmi closed 7 years ago

murugancmi commented 7 years ago

when i try to start endpoid i am getting following warn in my console and i never get any event

Possible Unhandled Promise Rejection (id: 1): Cannot read property 'start' of undefined TypeError: Cannot read property 'start' of undefined

bellow is my code

import {Platform, PushNotificationIOS, AppState} from 'react-native' import {Endpoint} from 'react-native-pjsip'

const telecmi={}

telecmi['startAgent']= async function(username,password) {

let endpoint = new Endpoint(); console.log(endpoint) let state = await endpoint.start(); // List of available accounts and calls when RN context is started, could not be empty because Background service is working on Android let {accounts, calls, settings, connectivity} = state;

let configuration = { "name": "John", "username":'xxxxxxx', "domain": "voip.telecmi.com", "password":'xxxxxxx', "proxy": null, "transport": null, // Default TCP "regServer": null, // Default wildcard "regTimeout": null // Default 3600 }; endpoint.createAccount().then((account) => { alert(account) console.log("Account created", account); });

endpoint.on("registration_changed", (account) => {

console.log(account) });

}

export default telecmi;

datso commented 7 years ago

Hi, did you link library ? react-native link

murugancmi commented 7 years ago

yes i did that

rnpm-install info Android module react-native-pjsip is already linked rnpm-install info iOS module react-native-pjsip is already linked rnpm-install info Linking assets to ios project rnpm-install info Linking assets to android project rnpm-install info Assets have been successfully linked to your project

datso commented 7 years ago

Is Endpoint undefined ? Did you rebuild app after linking ? Which platform (iOS/Android) ?

murugancmi commented 7 years ago

Yes Endpoint undefined No let me rebuild Android

After rebuild there is no warning message but nothing happen,Mean register event not fired

when i try react-native run

Unrecognized command 'run' Run react-native --help to see list of all available commands

May be react-native start :)

datso commented 7 years ago

Yeap, react-native run should solve the problem :)

murugancmi commented 7 years ago

After rebuild there is no warning message but nothing happen,Mean register event not fired

when i try react-native run

Unrecognized command 'run' Run react-native --help to see list of all available commands

May be react-native start :)

datso commented 7 years ago

Oh, yeap, I mean run-android. You can explore error inside device logs adb logcat.