Closed talhafiaz09 closed 3 years ago
yeah, me stuck on this too. i hope author can help us
@subiyantoro i have solved this issue
i can share my config with you the problem was in configuration. let state = await endpoint.start(); let {accounts, calls, settings, connectivity} = state; endpoint.on('registration_changed', (account) => { if (account._registration._active) { setAccount(account); console.log('Registration changed: ', account); } }); endpoint.on('connectivity_changed', (online) => { console.log('Connectivity changed: ', online); }); endpoint.on('call_received', (call) => { console.log('Call received: ', call); }); endpoint.on('call_changed', (call) => { console.log('Call changed: ', call); }); endpoint.on('call_terminated', (call) => { console.log('Terminated: ', call); }); let configuration = { name: 'retail', username: 'xyzzz', domain: '194.28.167.180', password: '***', proxy: 'sip:194.28.167.180:5060', // default disabled. transport: 'UDP', // default TCP regServer: null, // default taken from domain regTimeout: 1000, // default 300 }; endpoint .createAccount(configuration) .then((account) => {}) .catch((e) => { console.log(e); });
Do it like this and wait until your account status changes. You may need a VPN as in my case sip calling is not allowed in my country. :)
it's work, thanks @talhafiaz09 , do you mind to share the function setAccount code
@subiyantoro there is no such function setAccount in pjsip
hello this is my code and I'm facing the same issue how can I resolve ?
import React from 'react' import { StyleSheet, Text, View } from 'react-native' import { Endpoint } from 'react-native-pjsip'
const App = async () => { let endpoint = new Endpoint(); let state = await endpoint.start(); let { accounts, calls, settings, connectivity } = state; endpoint.on('registration_changed', (account) => { if (account._registration._active) { setAccount(account); console.log('Registration changed: ', account); } }); endpoint.on('connectivity_changed', (online) => { console.log('Connectivity changed: ', online); }); endpoint.on('call_received', (call) => { console.log('Call received: ', call); }); endpoint.on('call_changed', (call) => { console.log('Call changed: ', call); }); endpoint.on('call_terminated', (call) => { console.log('Terminated: ', call); }); let configuration = { "name": "101", "username": "101", "domain": "pbx.trendsjo.com", "password": "sa1234qq", "proxy": null, "transport": "WSS", // Default TCP "regServer": "wss://pbx.trendsjo.com:8089", // Default wildcard "regTimeout": 1000, // Default 3600 "regHeaders": { "X-Custom-Header": "Value" }, "regContactParams": ";unique-device-token-id=XXXXXXXXX" }; endpoint .createAccount(configuration) .then((account) => { console.log("ACCOUNT CREATED:", account) }) .catch((e) => { console.log(e); }); return (
) }
export default App
const styles = StyleSheet.create({})
@syeda-sumreen-ali let me check your code snippet
@syeda-sumreen-ali please reconfirm that is your configurations valid and the also please recheck the port you are assigning
@talhafiaz09 Can you please help me finding the issue in my code ? Actually I'm also getting the same issue. Actually I have server URL, username and password and I want to createAccount but always getting account state false.
let configuration = {}
configuration.username = 'xxxxxx';
configuration.domain = 'sip.xxxxx.com';
configuration.password = "xxxxxxxx";
configuration.transport = "WSS",
configuration.regServer = 'wss://xxxxxxx/ws',
configuration.regTimeout = null,
configuration.regHeaders = {
"X-Custom-Header": "Value"
},
configuration.regContactParams = ";unique-device-token-id=XXXXXXXXX"
console.log(configuration)
await endpoint.createAccount(configuration)
.then((returnAcc) => {
console.log("-------", returnAcc);
this.setState({ account: returnAcc });
}).catch((e) => {
console.log("Error", e);
});
@talhafiaz09 Can you please help me finding the issue in my code ? Actually I'm also getting the same issue.
Actually I have server URL, username and password and I want to createAccount but always getting account state false.
let configuration = {} configuration.username = 'xxxxxx'; configuration.domain = 'sip.xxxxx.com'; configuration.password = "xxxxxxxx"; configuration.transport = "WSS", configuration.regServer = 'wss://xxxxxxxws', configuration.regTimeout = null, configuration.regHeaders = { "X-Custom-Header": "Value" }, configuration.regContactParams = ";unique-device-token-id=XXXXXXXXX" console.log(configuration) await endpoint.createAccount(configuration) .then((returnAcc) => { console.log("-------", returnAcc); this.setState({ account: returnAcc }); }).catch((e) => { console.log("Error", e); });
yes brother i can help you as soon as possible and will share it with you
Hi @talhafiaz09 Any update ?? Thanks in advance!
Every time I try to connect to my SIP server it gives me active false. I tried using a VPN but still, it shows me the same response. Can anyone please guide me or if someone has used this library then please help me? This is a snippet of the response I get: