Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting error while creating account "_registration": {"_active": false, "_reason": undefined, "_status": "PJSIP_SC_TRYING", "_statusText": "In Progress"}} #234

Open
syeda-sumreen-ali opened this issue Apr 24, 2021 · 4 comments

Comments

@syeda-sumreen-ali
Copy link

syeda-sumreen-ali commented Apr 24, 2021

I'm try to connect my react-native application with asterik server using react-native-pjsip but getting error

ERROR

registration": {"active": false, "status": "PJSIP_SC_TRYING", "statusText": "In Progress"}, "transport": "WSS", "uri": "101 sip:101@pbx.trendsjo.com", "username": "101"}, "_registration": {"_active": false, "_reason": undefined, "_status": "PJSIP_SC_TRYING", "_statusText": "In Progress"}}

ANDROID_MANIFEST FILE

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.callapp">

    <uses-permission android:name="android.permission.INTERNET" `/>`
    <uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus"/>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
       <service
        android:name="com.carusto.ReactNativePjSip.PjSipService"
        android:enabled="true"
        android:exported="true" />
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>


    <service
        android:name="com.carusto.ReactNativePjSip.PjSipService"
        android:enabled="true"
        android:exported="true" />

    </application>
</manifest>

### CODE

import React, { PureComponent } from 'react'
import { Text, View } from 'react-native'
import { Endpoint } from 'react-native-pjsip'


export class App extends PureComponent {

  handleSIP = 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", // 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);
      });
  }
  componentDidMount() {
    this.handleSIP()
  }
  render() {
    return (
      <View>
        <Text> SIP TESTING </Text>
      </View>
    )
  }
}

export default App

@Umer919
Copy link

Umer919 commented Apr 29, 2021

use react native Agora package for calling feature

npm i react-native-agora
install packages and delete the previous file of Webrtc
and then execute the command
Npm Start inside the project folder

@Sulbha-Mishra29
Copy link

I'm try to connect my react-native application with asterik server using react-native-pjsip but getting error

ERROR

registration": {"active": false, "status": "PJSIP_SC_TRYING", "statusText": "In Progress"}, "transport": "WSS", "uri": "101 sip:101@pbx.trendsjo.com", "username": "101"}, "_registration": {"_active": false, "_reason": undefined, "_status": "PJSIP_SC_TRYING", "_statusText": "In Progress"}}

ANDROID_MANIFEST FILE

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.callapp">

    <uses-permission android:name="android.permission.INTERNET" `/>`
    <uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus"/>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
       <service
        android:name="com.carusto.ReactNativePjSip.PjSipService"
        android:enabled="true"
        android:exported="true" />
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>


    <service
        android:name="com.carusto.ReactNativePjSip.PjSipService"
        android:enabled="true"
        android:exported="true" />

    </application>
</manifest>

### CODE

import React, { PureComponent } from 'react'
import { Text, View } from 'react-native'
import { Endpoint } from 'react-native-pjsip'


export class App extends PureComponent {

  handleSIP = 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", // 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);
      });
  }
  componentDidMount() {
    this.handleSIP()
  }
  render() {
    return (
      <View>
        <Text> SIP TESTING </Text>
      </View>
    )
  }
}

export default App

Any Update ??

@ReactNDev
Copy link

@syeda-sumreen-ali have you find out the solution ??
Thanks in advance!

@kiko111pro
Copy link

Here is the solution for iOS - Update your VialerPJSIP.framework folder located in node_modules/react-native-pjsip/iOS/VialerPJSIP.framework to this

If you're targeting android check android installation no need to update anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants