
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@telnyx/react-native-voice-sdk
Advanced tools
Telnyx React Native Voice SDK - A complete WebRTC voice calling solution
A comprehensive React Native SDK for Telnyx WebRTC voice calling.
npm install @telnyx/react-native-voice-sdk
import { TelnyxRTC, ClientOptions } from '@telnyx/react-native-voice-sdk';
// Initialize the client
const clientOptions: ClientOptions = {
login_token: 'your-jwt-token', // Recommended
// OR use login/password
// login: 'your-sip-username',
// password: 'your-sip-password',
};
const client = new TelnyxRTC(clientOptions);
// Connect to Telnyx
await client.connect();
// Make a call
const call = await client.newCall({
destinationNumber: '+1234567890',
callerIdName: 'John Doe'
});
// Listen for call events
call.on('telnyx.call.state', (call, state) => {
console.log(\`Call state: \${state}\`);
});
// Listen for client events
client.on('telnyx.client.ready', () => console.log('Ready!'));
client.on('telnyx.call.incoming', (call) => {
call.answer(); // or call.hangup()
});
The main client class for managing WebRTC connections and calls.
new TelnyxRTC(options: ClientOptions)
connect()
: Connect to Telnyx infrastructuredisconnect()
: Disconnect and cleanupnewCall(options: CallOptions)
: Create a new outgoing callprocessVoIPNotification(payload)
: Process VoIP push notificationqueueAnswerFromCallKit()
: Queue answer action for push callsqueueEndFromCallKit()
: Queue end action for push callstelnyx.client.ready
: Client is connected and readytelnyx.client.error
: Connection or authentication errortelnyx.call.incoming
: Incoming call receivedRepresents an individual voice call.
answer()
: Answer an incoming callhangup()
: End the callhold()
: Put call on holdunhold()
: Resume call from holddtmf(digits)
: Send DTMF tonestelnyx.call.state
: Call state changed ('new', 'ringing', 'active', 'ended', 'held')// Process push notification
client.processVoIPNotification(pushPayload);
// Enable auto-answer for next call (Android example)
import AsyncStorage from '@react-native-async-storage/async-storage';
await AsyncStorage.setItem('@auto_answer_next_call', 'true');
// Queue CallKit actions (iOS)
client.queueAnswerFromCallKit();
The SDK automatically handles network changes and reconnections.
// The client will automatically reconnect on network changes
client.on('telnyx.client.ready', () => {
console.log('Connected/Reconnected to Telnyx');
});
The SDK is written in TypeScript and includes full type definitions.
import {
TelnyxRTC,
ClientOptions,
CallOptions,
CallState,
Call
} from '@telnyx/react-native-voice-sdk';
import React, { useEffect, useState } from 'react';
import { TelnyxRTC, Call } from '@telnyx/react-native-voice-sdk';
export const VoiceApp = () => {
const [client, setClient] = useState<TelnyxRTC | null>(null);
const [call, setCall] = useState<Call | null>(null);
useEffect(() => {
const telnyxClient = new TelnyxRTC({
login_token: 'your-jwt-token'
});
telnyxClient.on('telnyx.client.ready', () => {
console.log('Ready for calls!');
});
telnyxClient.on('telnyx.call.incoming', (incomingCall) => {
setCall(incomingCall);
// Auto-answer or show incoming call UI
incomingCall.answer();
});
telnyxClient.connect();
setClient(telnyxClient);
return () => telnyxClient.disconnect();
}, []);
const makeCall = async () => {
if (client) {
const newCall = await client.newCall({
destinationNumber: '+1234567890'
});
setCall(newCall);
}
};
return (
// Your call UI here
<></>
);
};
This package requires:
@react-native-community/netinfo
- Network state monitoringreact-native-webrtc
- WebRTC functionalityeventemitter3
- Event handlingloglevel
- Logginguuid-random
- UUID generationMIT License
FAQs
Telnyx React Native Voice SDK - A complete WebRTC voice calling solution
The npm package @telnyx/react-native-voice-sdk receives a total of 76 weekly downloads. As such, @telnyx/react-native-voice-sdk popularity was classified as not popular.
We found that @telnyx/react-native-voice-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.