Get Started
OutRival Voice Call SDK
Voice Calls for OutRival API in your web application
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Voice Calls for OutRival API in your web application
npm install @outrival/voice-call
import VoiceCall from "@outrival/voice-call";
const voiceCall = new VoiceCall({
publicKey: "YOUR PUBLIC KEY",
// OR
token: "TOKEN GENERATED BY API",
});
voiceCall.start({
companionId: string; // Required - Companion ID
userId: string; // Optional
variables: Record<string, any>; // Optional
metadata: Record<string, any>; // Optional
});
voiceCall.stop();
// Mute microphone
voiceCall.mute();
// Unmute microphone
voiceCall.unmute();
// Check if the microphone is currently muted
voiceCall.isMuted();
voiceCall.on('speech-start', () => {
console.log('Speech has started');
});
voiceCall.on('speech-end', () => {
console.log('Speech has ended');
});
voiceCall.on('call-start', () => {
console.log('Call has started');
});
voiceCall.on('call-end', () => {
console.log('Call has stopped');
});
voiceCall.on('volume-level', (volume) => {
console.log(`Companion volume level: ${volume}`);
});
voiceCall.on('transcript', (message) => {
console.log(`${message.role === "user" ? "User" : "Companion"} transcript:`);
console.log(message.transcript);
});
voiceCall.on('function-call', (function) => {
console.log(`Function ${function.name} was called with arguments ${function.arguments}`);
});
voiceCall.on('error', (e) => {
console.error(e);
});