
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
@toandn96/react-native-pjsip
Advanced tools
A PJSIP module for React Native.
First of all you have to initialize module to be able to work with it.
There are some interesting moment in initialization. When application goes to background, PJSIP module is still working and able to receive calls, but your javascipt is totally suspended. When User open your application, javascript start to work and now your js application need to know what status have your account or may be you have pending incoming call.
So thats why first step should call start method for pjsip module.
import {Endpoint} from '@toandn96/react-native-pjsip'
let endpoint = new 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;
// Subscribe to endpoint events
endpoint.on("registration_changed", (account) => {});
endpoint.on("connectivity_changed", (online) => {});
endpoint.on("call_received", (call) => {});
endpoint.on("call_changed", (call) => {});
endpoint.on("call_terminated", (call) => {});
endpoint.on("call_screen_locked", (call) => {}); // Android only
Account creating is pretty strainghforward.
let configuration = {
"name": "John",
"username": "sip_username",
"domain": "pbx.carusto.com",
"password": "****",
"proxy": null,
"transport": null, // Default TCP
"regServer": null, // Default wildcard
"regTimeout": null // Default 3600
"regHeaders": {
"X-Custom-Header": "Value"
},
"regContactParams": ";unique-device-token-id=XXXXXXXXX"
};
endpoint.createAccount().then((account) => {
console.log("Account created", account);
});
To be able to make a call first of all you should createAccount, and pass account instance into Endpoint.makeCall function. This function will return a promise that will be resolved when PjSIP initializes the call.
let options = {
headers: {
"P-Assserted-Identity": "Header example",
"X-UA": "React native"
}
}
let call = await endpoint.makeCall(account, destination, options);
call.getId() // Use this id to detect changes and make actions
endpoint.addListener("call_changed", (newCall) => {
if (call.getId() === newCall.getId()) {
// Our call changed, do smth.
}
}
endpoint.addListener("call_terminated", (newCall) => {
if (call.getId() === newCall.getId()) {
// Our call terminated
}
}
The demo project is https://github.com/toandn96/react-native-pjsip-app. And you will need a SIP server.
FAQs
PJSIP module for React Native
We found that @toandn96/react-native-pjsip demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.