
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.
react-softphone
Advanced tools
A modern WebRTC softphone component for React applications with all dependencies bundled and zero translation dependencies.
Modern, clean interface with call controls, settings, and multi-channel support
npm install react-softphone
and you're readynpm install react-softphone
That's it! All MUI dependencies are bundled - no additional packages needed.
Follow this complete tutorial to get React Softphone working in your app:
# Create a new React application
npx create-react-app my-softphone-app
cd my-softphone-app
# Install the react-softphone package
npm install react-softphone
Create the required audio files in your public
directory:
# Create sound directory
mkdir public/sound
# Add your audio files (you'll need to provide these)
# public/sound/ringing.ogg - Incoming call ringtone
# public/sound/ringback.ogg - Outgoing call ringback tone
Replace the contents of src/App.js
with:
import React, { useState } from 'react';
import SoftPhone from 'react-softphone';
import './App.css';
function App() {
// State to control softphone visibility
const [softPhoneOpen, setSoftPhoneOpen] = useState(false);
// Your SIP server configuration
const sipConfig = {
domain: 'your-sip-server.com', // Your SIP domain
uri: 'sip:your-extension@your-sip-server.com', // Your SIP URI
password: 'your-sip-password', // Your SIP password
ws_servers: 'wss://your-sip-server.com:8089/ws', // WebSocket server
display_name: 'Your Name', // Display name for calls
debug: false, // Set to true for debugging
session_timers_refresh_method: 'invite'
};
// Settings state with localStorage persistence
const [callVolume, setCallVolume] = useState(() => {
const saved = localStorage.getItem('softphone-call-volume');
return saved ? parseFloat(saved) : 0.8;
});
const [ringVolume, setRingVolume] = useState(() => {
const saved = localStorage.getItem('softphone-ring-volume');
return saved ? parseFloat(saved) : 0.6;
});
const [notifications, setNotifications] = useState(() => {
const saved = localStorage.getItem('softphone-notifications');
return saved ? JSON.parse(saved) : true;
});
const [connectOnStart, setConnectOnStart] = useState(() => {
const saved = localStorage.getItem('softphone-connect-on-start');
return saved ? JSON.parse(saved) : false;
});
// Functions to save settings (implement localStorage if needed)
const saveConnectOnStart = (value) => {
setConnectOnStart(value);
localStorage.setItem('softphone-connect-on-start', value);
};
const saveNotifications = (value) => {
setNotifications(value);
localStorage.setItem('softphone-notifications', value);
};
const saveCallVolume = (value) => {
setCallVolume(value);
localStorage.setItem('softphone-call-volume', value);
};
const saveRingVolume = (value) => {
setRingVolume(value);
localStorage.setItem('softphone-ring-volume', value);
};
return (
<div className="App">
<header className="App-header">
<h1>π My Softphone App</h1>
<p>Click the button below to open the softphone</p>
<button
onClick={() => setSoftPhoneOpen(true)}
style={{
padding: '12px 24px',
fontSize: '16px',
backgroundColor: '#1976d2',
color: 'white',
border: 'none',
borderRadius: '4px',
cursor: 'pointer',
marginBottom: '20px'
}}
>
π Open Softphone
</button>
<SoftPhone
// Visibility control
softPhoneOpen={softPhoneOpen}
setSoftPhoneOpen={setSoftPhoneOpen}
// Audio settings
callVolume={callVolume}
ringVolume={ringVolume}
// Connection settings
connectOnStart={connectOnStart}
notifications={notifications}
// SIP configuration
config={sipConfig}
// Settings callbacks
setConnectOnStartToLocalStorage={saveConnectOnStart}
setNotifications={saveNotifications}
setCallVolume={saveCallVolume}
setRingVolume={saveRingVolume}
// Optional: Built-in floating launcher
builtInLauncher={true}
launcherPosition="bottom-right"
launcherSize="medium"
launcherColor="primary"
// Optional: Accounts for call transfer
asteriskAccounts={[]}
// Optional: Timezone for call history
timelocale="UTC"
/>
</header>
</div>
);
}
export default App;
Add these styles to src/App.css
:
.App {
text-align: center;
}
.App-header {
background-color: #282c34;
padding: 20px;
color: white;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.App-header h1 {
margin-bottom: 10px;
}
.App-header p {
margin-bottom: 30px;
opacity: 0.8;
}
Update the sipConfig
object in Step 4 with your actual SIP server details:
const sipConfig = {
domain: 'sip.yourprovider.com', // Replace with your SIP domain
uri: 'sip:1001@sip.yourprovider.com', // Replace with your extension
password: 'your-actual-password', // Replace with your SIP password
ws_servers: 'wss://sip.yourprovider.com:8089/ws', // Replace with your WebSocket URL
display_name: 'John Doe', // Replace with your name
debug: false // Set to true for troubleshooting
};
# Start the development server
npm start
Your app will open at http://localhost:3000
with a working softphone!
For troubleshooting, add this to your browser console:
window.__SOFTPHONE_DEBUG__ = true;
All dependencies are bundled with the package.
Property | Type | Description |
---|---|---|
config | Object | SIP configuration object (see below) |
setConnectOnStartToLocalStorage | Function | Callback to save auto-connect preference |
setNotifications | Function | Callback to save notification preference |
setCallVolume | Function | Callback to save call volume |
setRingVolume | Function | Callback to save ring volume |
Property | Type | Default | Description |
---|---|---|---|
softPhoneOpen | Boolean | false | Controls softphone visibility |
setSoftPhoneOpen | Function | () => {} | Callback when softphone opens/closes |
callVolume | Number | 0.5 | Call audio volume (0-1) |
ringVolume | Number | 0.5 | Ring audio volume (0-1) |
connectOnStart | Boolean | false | Auto-connect on component mount |
notifications | Boolean | true | Show browser notifications for calls |
timelocale | String | 'UTC' | Timezone for call history |
asteriskAccounts | Array | [] | List of available accounts for transfer |
builtInLauncher | Boolean | false | Show floating launcher button |
launcherPosition | String | 'bottom-right' | Launcher position ('bottom-right' , 'bottom-left' , etc.) |
launcherSize | String | 'medium' | Launcher size ('small' , 'medium' , 'large' ) |
launcherColor | String | 'primary' | Launcher color theme |
The config
prop must include these SIP settings:
const domain = 'your-sip-server.com';
const extension = 'your-extension';
const config = {
domain: domain,
uri: `sip:${extension}@${domain}`,
password: 'your-password',
ws_servers: `wss://${domain}:8089/ws`,
display_name: extension,
debug: false,
session_timers_refresh_method: 'invite'
};
Place these audio files in your public/sound/
directory:
ringing.ogg
- Incoming call ringtoneringback.ogg
- Outgoing call ringback toneThe softphone includes an optional floating launcher button:
<SoftPhone
config={config}
builtInLauncher={true}
launcherPosition="bottom-right"
launcherSize="medium"
launcherColor="primary"
// ... other props
/>
Available positions: bottom-right
, bottom-left
, top-right
, top-left
Available sizes: small
, medium
, large
Available colors: primary
, secondary
, success
, error
, warning
, info
To enable debug logging for troubleshooting:
// Enable debug mode in your app
window.__SOFTPHONE_DEBUG__ = true;
// Now all debug messages will appear in browser console
This will show detailed logs for:
# Clone the repository
git clone https://github.com/chamuridis/react-softphone.git
# Install dependencies
npm install
# Build the package
npm run build
# Create package
npm pack
# Install the created package in your project
npm install ../react-softphone/react-softphone-*.tgz
ISC Β© chamuridis
FAQs
Webrtc Softphone React
The npm package react-softphone receives a total of 927 weekly downloads. As such, react-softphone popularity was classified as not popular.
We found that react-softphone demonstrated a healthy version release cadence and project activity because the last version was released less than 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.