callcenter.js-mcp
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"callcenter.js": {
"args": [
"dist/cli.js",
"--mcp"
],
"command": "node",
"cwd": "/path/to/voip-agent"
}
}
}
服务介绍
CallCenter.js MCP + CLI
An MCP Server, CLI tool, and API that makes phone calls on your behalf using VoIP.
Just tell Claude what you want to accomplish, and it will call and handle the conversation for you. This is essentially an MCP Server that bridges between OpenAI's Real-Time Voice API and your VoIP connection to call people on your behalf.
** Vibe-coded side project!** Please do not use this in any kind of professional context. This is a side project coded in a weekend. There are no guard rails. Your MCP client can call any number with this, even if you don't ask it to. In fact, it has done so during testing - it called a random number during the night "for testing" and played back scary low-pitched noises - then claimed it called MY number. So YMMV, no warranties. See disclaimer below.
Example: Order Pizza with Claude
You: "Can you call Tony's Pizza and order a large pepperoni pizza for delivery to 123 Main St? My name is John and my number is 555-0123."
Claude automatically calls the restaurant:
mcp__callcenter_js__simple_call(phone_number: "+15551234567",
brief: "Call Tony's Pizza and order a large pepperoni pizza for delivery to 123 Main St. Customer name is John, phone number 555-0123",
caller_name: "John")
# Simple Call Result
**Status:** Success
**Duration:** 3 minutes 24 seconds
**Call ID:** abc123xyz
## Call Transcript
[14:23:15] HUMAN: Tony's Pizza, how can I help you?
[14:23:15] ASSISTANT: Hi! I'm calling on behalf of John to place a delivery order.
[14:23:20] HUMAN: Sure! What would you like?
[14:23:20] ASSISTANT: I'd like to order one large pepperoni pizza for delivery please.
[14:23:25] HUMAN: Large pepperoni, got it. What's the delivery address?
[14:23:25] ASSISTANT: The address is 123 Main Street.
[14:23:30] HUMAN: And your phone number?
[14:23:30] ASSISTANT: The phone number is 555-0123.
[14:23:35] HUMAN: Perfect! That'll be $18.99. We'll have it delivered in about 30 minutes.
[14:23:40] ASSISTANT: That sounds great! Thank you so much.
[14:23:42] HUMAN: You're welcome! Have a great day.
Pizza ordered successfully!
Quick Context for the Uninitiated
VoIP (Voice over IP) is how you make phone calls over the internet instead of traditional phone lines. SIP (Session Initiation Protocol) is the language these systems speak to connect calls. Think of it as HTTP but for phone calls.
Fritz!Box is a popular German router/modem that happens to have a built-in phone system (PBX). If you have one, you already have everything you need to make VoIP calls - this tool just connects to it. Outside Germany, you might know similar devices from other brands, or use dedicated VoIP services like Asterisk, 3CX, or cloud providers.
MCP (Model Context Protocol) is Anthropic's standard for connecting AI assistants like Claude to external tools and services. It's what lets MCP clients actually do things instead of just talking about them.
What This Enables
- MCP Server - Use directly in Claude Code or any MCP client (most popular usage)
- CLI Tool - Command-line interface for direct phone calls
- TypeScript API - Programmatic library for building voice applications
Built as a bridge between OpenAI's Real-Time Voice API and VoIP networks, with multiple codec support (G.722, G.711), and expanded SIP protocol support for broad VoIP compatibility. Compatible with the latest gpt-realtime model released August 28, 2025.
System Architecture
graph TB
subgraph "User Interface"
A[Claude Code/MCP Client]
B[CLI Tool]
C[TypeScript API]
end
subgraph "CallCenter.js Core"
D[MCP Server]
E[VoiceAgent]
F[Call Brief Processor<br/>o3-mini model]
end
subgraph "Communication Layer"
G[SIP Client<br/>Provider Support]
H[Audio Bridge<br/>RTP Streaming]
end
subgraph "Audio Processing"
I[G.722 Codec<br/>16kHz Wideband]
J[G.711 Codec<br/>8kHz Fallback]
end
subgraph "External Services"
K[OpenAI Real-Time API<br/>gpt-realtime model]
L[VoIP Network<br/>Fritz!Box/Asterisk/etc]
end
A --> D
B --> E
C --> E
D --> E
E --> F
E --> G
E --> H
F --> K
G --> L
H --> I
H --> J
H --> K
style F fill:#e1f5fe
style K fill:#fff3e0
style L fill:#f3e5f5
** Vibe-coded project!** Developed and tested on Fritz!Box (a German router with built-in VoIP) only. Other provider configs are research-based but untested. YMMV, no warranties. See disclaimer below.
MCP Client Integration (Most Popular!)
Perfect for when your coding agent needs to call library authors to complain about their documentation!
Quick Setup
# Add to Claude Code with one command:
claude mcp add --env SIP_USERNAME=your_actual_extension \
--env SIP_PASSWORD="your_actual_password" \
--env SIP_SERVER_IP=192.168.1.1 \
--env OPENAI_API_KEY="sk-your_actual_openai_key" \
--env USER_NAME="Your Actual Name" \
-- callcenter.js npx -- github:gerkensm/callcenter.js-mcp --mcp
Then just ask your MCP Client to make calls:
"Can you call the pizza place and order a large pepperoni? My number is 555-0123."
Your MCP Client will automatically handle the entire conversation using the AI Voice Agent!
Key Features
- Multiple Codec Support: G.722 wideband (16kHz) + G.711 fallback for broad compatibility
- Compiler-Free WASM Codec: Ships with a prebuilt G.722 WebAssembly module so
npxusers get wideband audio without installing build tools (native addon still available for max performance) - AI-Powered Conversations: Uses OpenAI's Real-Time Voice API with the latest
gpt-realtimemodel (released August 28, 2025) for actual calls, with o3-mini model for instruction generation - Automatic Language Detection: Intelligently detects conversation language from call briefs and configures transcription accordingly
- Auto Voice Selection: New 'auto' mode where o3-mini selects optimal voice based on call context (formality, industry, goals)
- Voice Characteristics: Full support for all 10 OpenAI Realtime API voices with gender and personality awareness
- Expanded SIP Support: Configurations for common SIP providers (Fritz!Box tested, others experimental)
- Smart Configuration: Auto-detects provider requirements and optimizes settings
- Enterprise-Ready: Supports advanced SIP features (STUN/TURN, session timers, transport fallback)
- Robust Connection Management: Automatic reconnection with intelligent error handling
- Built-in Validation: Comprehensive configuration validation with network testing
- Provider Profiles: Pre-configured settings for popular SIP systems
- MCP Server: Integrate with MCP clients like Claude Code
- TypeScript API: Programmatic library for building voice applications
- Call Brief Processing: Natural language call instructions using o3-mini model with structured JSON output
- Optional Call Recording: Stereo WAV recording with caller/AI separation
Quick Start
Option 1: Run Instantly with npx (No Installation)
Fastest way to try it out:
# Set environment variables (or create .env file)
export SIP_USERNAME="your_extension"
export SIP_PASSWORD="your_password"
export SIP_SERVER_IP="192.168.1.1"
export OPENAI_API_KEY="sk-your-key-here"
# Run directly from GitHub (no installation needed!)
npx github:gerkensm/callcenter.js-mcp call "+1234567890" --brief "Call restaurant for reservation" --user-name "Your Name"
Or using a .env file:
# Create .env file
cat > .env << EOF
SIP_USERNAME=your_extension
SIP_PASSWORD=your_password
SIP_SERVER_IP=192.168.1.1
OPENAI_API_KEY=sk-your-key-here
SIP_PROVIDER=fritz-box
OPENAI_VOICE=auto
EOF
# Run from GitHub (loads .env automatically)
npx github:gerkensm/callcenter.js-mcp call "+1234567890" --brief "Call restaurant"
Note: High-quality G.722 audio ships as a prebuilt WebAssembly module, so npx works even on machines without compilers. If you want the faster native addon instead, run npm run build:native (or npm run build:all) after cloning.
Option 2: Local Installation
Prerequisites
- Node.js 20+
- (Optional) Python 3.x + C/C++ build tools only needed if you plan to rebuild the native addon instead of using the bundled WebAssembly codec
- macOS: Xcode Command Line Tools (
xcode-select --install) - Windows: Visual Studio Build Tools
- Linux:
build-essentialpackage
- macOS: Xcode Command Line Tools (
- OpenAI API key
Note: The prebuilt WebAssembly codec already provides wideband G.722 audio out of the box. Rebuilding the native addon is optional and mainly useful for squeezing out a little more performance.
Installation
# Clone and install
git clone https://github.com/gerkensm/callcenter.js-mcp
cd callcenter.js-mcp
npm install
# Copy example configuration
cp config.example.json config.json
Configuration
Edit config.json with your settings:
{
"sip": {
"username": "your_sip_username",
"password": "your_sip_password",
"serverIp": "192.168.1.1",
"serverPort": 5060,
"provider": "fritz-box"
},
"ai": {
"openaiApiKey": "sk-your-openai-api-key-here",
"voice": "alloy",
"instructions": "You are a helpful AI assistant making phone calls on behalf of users.",
"userName": "Your Name"
}
}
Usage Options
1. MCP Server (Claude Code Integration)
Most popular usage - integrates with Claude Code for seamless AI-powered calling. Perfect for when your coding agent needs to call library authors to complain about their documentation!
Quick Setup with npx (Recommended)
Option 1: Using MCP Client CLI (Easiest)
# Replace with your ACTUAL credentials before running:
claude mcp add --env SIP_USERNAME=your_actual_extension \
--env SIP_PASSWORD="your_actual_password" \
--env SIP_SERVER_IP=192.168.1.1 \
--env OPENAI_API_KEY="sk-your_actual_openai_key" \
--env USER_NAME="Your Actual Name" \
-- callcenter.js npx -- github:gerkensm/callcenter.js-mcp --mcp
** Important:** Replace the placeholder values with your actual SIP credentials and OpenAI API key, or the server will fail to connect.
Option 2: Manual Configuration
Configure in Claude Code's MCP settings to automatically pull from GitHub:
{
"mcpServers": {
"callcenter.js": {
"command": "npx",
"args": ["github:gerkensm/callcenter.js-mcp", "--mcp"],
"env": {
"SIP_USERNAME": "your_extension",
"SIP_PASSWORD": "your_password",
"SIP_SERVER_IP": "192.168.1.1",
"OPENAI_API_KEY": "sk-your-key-here",
"USER_NAME": "Your Name"
}
}
}
}
Alternative: Local Installation
For local development or if you prefer local installation:
npm start --mcp
Or configure Claude Code with local installation:
{
"mcpServers": {
"callcenter.js": {
"command": "node",
"args": ["dist/cli.js", "--mcp"],
"cwd": "/path/to/voip-agent"
}
}
}
Available MCP tools:
simple_call- Make calls with automatic instruction generationadvanced_call- Make calls with granular parameter control
Example usage in MCP Client:
You: "Can you call Bocca di Bacco restaurant and book a table for 2 people tonight at 7:30pm? My name is John Doe."
MCP Client: I'll call Bocca di Bacco restaurant to book a table for 2 people tonight at 7:30pm.
mcp__ai-voice-agent__simple_call(
phone_number: "+1234567890",
brief: "Call Bocca di Bacco restaurant and book a table for 2 people tonight at 7:30pm",
caller_name: "John Doe"
)
Call completed successfully!
Duration: 2 minutes 15 seconds
Reservation confirmed for 2 people at 7:30pm tonight
More examples:
You: "My internet is down. Can you call my ISP and get a status update? I'm Sarah Johnson, account #12345."
MCP Client: I'll call your internet service provider to check on the outage status.
mcp__ai-voice-agent__simple_call(
phone_number: "+18005551234",
brief: "Call ISP about internet outage, customer Sarah Johnson account #12345",
caller_name: "Sarah Johnson"
)
You: "Call Dr. Smith's office to reschedule my 3pm appointment to next week. I'm Mike Chen."
MCP Client: I'll call Dr. Smith's office to reschedule your appointment.
mcp__ai-voice-agent__simple_call(
phone_number: "+15551234567",
brief: "Call Dr. Smith's office to reschedule Mike Chen's 3pm appointment to next week",
caller_name: "Mike Chen"
)
The MCP Client automatically handles the entire conversation using the AI Voice Agent!
2. Command Line Interface
Perfect for when you need to curl -X POST your way out of social obligations, or finally implement that O(n log n) ai-human-sort algorithm - because nothing says "efficient sorting" like crowdsourcing comparisons to random strangers via VoIP!
** Use --brief instead of --instructions for better results!**
The --brief option uses OpenAI's o3-mini model to generate sophisticated instructions from your simple description, while --instructions sends your text directly to the Real-Time Voice API. Since the Real-Time Voice API is optimized for speed (not sophistication), --brief typically produces much better call outcomes.
# RECOMMENDED: Use brief for natural language goals
npm start call "+1234567890" --brief "Call the restaurant and book a table for 2 at 7pm tonight" --user-name "John Doe"
# RECOMMENDED: Brief works for any call type
npm start call "+1234567890" --brief "Call to check appointment availability for John Doe"
# ONLY use instructions for very specific, custom behavior
npm start call "+1234567890" --instructions "You must follow this exact script: Say hello, ask for manager, then hang up"
# Other examples with brief
npm start call "+1234567890" --record "meeting.wav" --duration 300 --brief "Conference call to discuss project status"
npm start call "+1234567890" --log-level verbose --brief "Test call to verify connectivity"
CLI Options
npm start call <number> [options]
Options:
-c, --config <path> Configuration file path (default: config.json)
-d, --duration <seconds> Maximum call duration in seconds (default: 600)
-v, --verbose Verbose mode - show all debug information
-q, --quiet Quiet mode - show only transcripts, errors, and warnings
--log-level <level> Set log level (quiet|error|warn|info|debug|verbose) (default: info)
--no-colors Disable colored output
--no-timestamp Disable timestamps in logs
--record [filename] Enable stereo call recording (optional filename)
--brief <text> Call brief to generate instructions from (RECOMMENDED)
--instructions <text> Direct AI instructions (use only for specific custom behavior)
--user-name <name> Your name for the AI to use when calling
--voice <name> Voice to use (default: auto) - see Voice Selection section
--help Display help information
3. Programmatic API
import { makeCall, createAgent } from 'callcenter.js';
// Simple call with brief
const result = await makeCall({
number: '+1234567890',
brief: 'Call Bocca di Bacco and book a table for 2 at 19:30 for Torben',
userName: 'Torben',
config: 'config.json'
});
console.log(`Call duration: ${result.duration}s`);
console.log(`Transcript: ${result.transcript}`);
// Advanced usage with agent instance
const agent = await createAgent('config.json');
agent.on('callEnded', () => {
console.log('Call finished!');
});
await agent.makeCall({
targetNumber: '+1234567890',
duration: 300
});
API Reference
makeCall(options: CallOptions): Promise<CallResult>
Make a phone call with the AI agent.
CallOptions
interface CallOptions {
number: string; // Phone number to call
duration?: number; // Call duration in seconds
config?: string | Config; // Configuration file path or object
instructions?: string; // Direct AI instructions (highest priority)
brief?: string; // Call brief to generate instructions from
userName?: string; // Your name for the AI to use
recording?: boolean | string; // Enable recording with optional filename
logLevel?: 'quiet' | 'error' | 'warn' | 'info' | 'debug' | 'verbose';
colors?: boolean; // Enable colored output
timestamps?: boolean; // Enable timestamps in logs
}
CallResult
interface CallResult {
callId?: string; // Call ID if successful
duration: number; // Call duration in seconds
transcript?: string; // Full conversation transcript
success: boolean; // Whether call was successful
error?: string; // Error message if failed
}
createAgent(config, options?): Promise<VoiceAgent>
Create a VoiceAgent instance for advanced use cases.
const agent = await createAgent('config.json', {
enableCallRecording: true,
recordingFilename: 'call.wav'
});
// Event handlers
agent.on('callInitiated', ({ callId, target }) => {
console.log(`Call ${callId} started to ${target}`);
});
agent.on('callEnded', () => {
console.log('Call ended');
});
agent.on('error', (error) => {
console.error('Call error:', error.message);
});
Configuration Structure
interface Config {
sip: {
username: string;
password: string;
serverIp: string;
serverPort?: number;
provider?: string;
stunServers?: string[];
turnServers?: TurnServer[];
};
ai: {
openaiApiKey: string;
voice?: 'auto' | 'alloy' | 'ash' | 'ballad' | 'cedar' | 'coral' | 'echo' | 'marin' | 'sage' | 'shimmer' | 'verse';
instructions?: string;
brief?: string;
userName?: string;
};
logging?: {
level?: string;
};
}
Environment Variables
All configuration options can be set via environment variables (useful for npx usage):
Required Variables:
SIP_USERNAME=your_extension
SIP_PASSWORD=your_password
SIP_SERVER_IP=192.168.1.1
OPENAI_API_KEY=sk-your-key-here
USER_NAME="Your Name" # Required when using --brief
Optional Variables:
# SIP Configuration
SIP_SERVER_PORT=5060
SIP_LOCAL_PORT=5060
SIP_PROVIDER=fritz-box # fritz-box, asterisk, cisco, 3cx, generic
STUN_SERVERS="stun:stun.l.google.com:19302,stun:stun2.l.google.com:19302"
SIP_TRANSPORTS="udp,tcp"
# OpenAI Configuration
OPENAI_VOICE=auto # auto (recommended), marin, cedar, alloy, echo, shimmer, coral, sage, ash, ballad, verse
OPENAI_INSTRUCTIONS="Your custom AI instructions"
# Advanced SIP Features
SESSION_TIMERS_ENABLED=true
SESSION_EXPIRES=1800
SESSION_MIN_SE=90
SESSION_REFRESHER=uac
Priority order: CLI flags > Config file > Environment variables
Quick Success Check
Before making real calls, validate your setup with these safe tests:
1. Configuration Validation
# Basic validation - checks syntax and required fields
npm run validate config.json
# Detailed validation with network connectivity tests
npm run validate:detailed
# Get specific fix suggestions for issues
npm run validate:fix
2. Test Call to Yourself (Fritz!Box users)
# Call your own extension to verify audio quality (safe test)
npm start call "**620" --brief "Test call to check audio quality" --user-name "Your Name" --duration 30
# Or use your mobile number for end-to-end test
npm start call "+49123456789" --brief "Quick test call" --user-name "Your Name" --duration 15
3. What to Expect
- Working setup: Clear audio, proper AI responses, clean call termination
- Network issues: "Connection failed" errors check firewall/STUN settings
- Auth problems: "401 Unauthorized" verify SIP credentials
- Codec issues: Poor audio quality G.722 compilation may have failed
Pro tip: Start with
--duration 30for test calls to avoid long waits if something goes wrong.
Configuration Validation
The built-in validation system provides comprehensive analysis:
# Basic validation
npm run validate config.json
# Detailed validation with network connectivity tests
npm run validate:detailed
# Get specific fix suggestions for issues
npm run validate:fix
# Test example configurations for different providers
npm run validate:fritz-box # AVM Fritz!Box
npm run validate:asterisk # Asterisk PBX
npm run validate:cisco # Cisco CUCM
npm run validate:3cx # 3CX Phone System
npm run validate:generic # Generic SIP provider
The validator will check:
- Configuration syntax and required fields
- Provider-specific requirements
- Network connectivity to SIP server
- STUN server reachability
- Codec availability (G.722/G.711)
- Provider compatibility score
SIP Provider Compatibility
Actually Tested
- AVM Fritz!Box - German router brand with built-in VoIP/SIP phone system WORKS (only one actually tested)
Vibe-coded Configs (Educated Guesses)
- Asterisk PBX - Open source PBX (FreePBX, Elastix, etc.) UNTESTED
- Cisco CUCM - Enterprise Unified Communications UNTESTED
- 3CX Phone System - Popular business PBX UNTESTED
- Generic SIP Providers - Standards-compliant SIP trunks UNTESTED
Provider-Specific Features
The provider profiles are based on research and documentation, not actual testing:
| Provider | Transport | NAT Traversal | Session Timers | PRACK | Keepalive |
|---|---|---|---|---|---|
| Fritz Box | UDP | Not needed | Optional | Disabled | Re-register |
| Asterisk | UDP/TCP | STUN | Supported | Optional | OPTIONS ping |
| Cisco CUCM | TCP preferred | STUN required | Required | Required | OPTIONS ping |
| 3CX | TCP/UDP | STUN | Supported | Optional | Re-register |
Configuration Decision Tree
flowchart TD
A[Choose Your SIP Provider] --> B{Fritz!Box Router?}
B -->|Yes| C[ Use fritz-box profile<br/>UDP transport<br/>No STUN needed]
B -->|No| D{Enterprise System?}
D -->|Cisco CUCM| E[ Use cisco profile<br/>TCP transport<br/>STUN required<br/>Session timers + PRACK]
D -->|3CX| F[ Use 3cx profile<br/>TCP/UDP transport<br/>STUN recommended]
D -->|Asterisk/FreePBX| G[ Use asterisk profile<br/>UDP/TCP transport<br/>STUN for NAT]
D -->|Other| H[ Use generic profile<br/>Start with UDP<br/>Add STUN if needed]
C --> I[Configure Basic Settings]
E --> J[Configure Enterprise Settings]
F --> J
G --> J
H --> J
I --> K[Set SIP credentials<br/>serverIp = router IP<br/>typically 192.168.1.1]
J --> L[Set SIP credentials<br/>serverIp = server IP<br/>Add STUN servers]
K --> M{Network Location?}
L --> M
M -->|Local Network| N[ Basic setup complete<br/>Should work reliably]
M -->|Cloud/Remote| O[ May need additional<br/>STUN/TURN configuration]
style C fill:#c8e6c9
style E fill:#ffecb3
style F fill:#ffecb3
style G fill:#ffecb3
style H fill:#ffecb3
style N fill:#c8e6c9
style O fill:#ffe0b2
Configuration Examples
The project includes ready-to-use configurations for all major providers:
config.example.json- AVM Fritz!Box (home/SMB default)config.asterisk.example.json- Asterisk PBX with advanced featuresconfig.cisco.example.json- Cisco CUCM enterprise setupconfig.3cx.example.json- 3CX Phone System configurationconfig.generic.example.json- Generic SIP provider template
Audio Quality & Codecs
Codec Priority & Negotiation
- G.722 (Preferred) - 16kHz wideband, superior voice quality
- G.711 -law (Fallback) - 8kHz narrowband, universal compatibility
- G.711 A-law (Fallback) - 8kHz narrowband, European standard
G.722 Implementation
- Prebuilt WebAssembly codec bundled with the package so every install gets wideband audio out of the box
- Native C++ addon still available for optimal performance when you opt-in with
npm run build:native - Based on reference implementations from CMU and Sippy Software
- Automatic fallback to G.711 if codec loading fails for any reason
- Real-time encoding/decoding with low latency
Optional Call Recording
- Stereo WAV format with caller on left channel, AI on right channel
- Optional filename specification
- Synchronized audio streams for perfect alignment
- High-quality PCM recording at native sample rates
Testing Audio Quality
# Test codec availability
npm run test:codecs
# Rebuild all codec artifacts (native + WASM + TS) if you changed the C sources
npm run build:all
# Disable G.722 entirely if you only want the G.711 fallback
npm run build:no-g722
AI Call Brief Processing
Why This Matters: Real-Time Voice API Needs Better Instructions
OpenAI's Real-Time Voice API is optimized for speed, not sophistication. It's great at natural conversation but struggles with complex, goal-oriented tasks without very specific instructions. Here's the problem:
** What doesn't work well:**
# Vague brief - Real-Time Voice API will be confused and unfocused
npm start call "+1234567890" --brief "Call the restaurant and book a table"
** What's tedious and error-prone:**
# Writing detailed instructions manually every time
npm start call "+1234567890" --instructions "You are calling on behalf of John Doe to make a restaurant reservation for 2 people at Bocca di Bacco for tonight at 7pm. You should start by greeting them professionally, then clearly state your purpose. Ask about availability for 7pm, and if not available, ask for alternative times between 6-8pm. Confirm the booking details including date, time, party size, and get a confirmation number if possible. If you reach voicemail, leave a professional message with callback information..."
** What works brilliantly:**
# Simple brief - o3 model generates sophisticated instructions
npm start call "+1234567890" --brief "Call Bocca di Bacco and book a table for 2 at 7pm tonight" --user-name "John Doe"
How It Works
The system uses OpenAI's o3-mini reasoning model (their latest small reasoning model - smart but fast) to automatically generate detailed, sophisticated instructions from your simple brief. The o3-mini model:
- Analyzes your brief and understands the goal
- Creates conversation states and flow logic
- Generates specific instructions for each phase of the call
- Handles edge cases like voicemail, objections, and alternatives
- Adapts language and tone based on context
- Provides fallback strategies when things don't go as planned
Call Flow Sequence
sequenceDiagram
participant U as User/Claude
participant V as VoiceAgent
participant B as Brief Processor<br/>(o3-mini)
participant S as SIP Client
participant A as Audio Bridge
participant O as OpenAI Realtime<br/>(gpt-realtime)
participant P as Phone/VoIP
U->>V: makeCall({brief, number, userName})
V->>B: Process brief with o3-mini
B->>B: Generate detailed instructions<br/>& conversation states
B->>V: Sophisticated call instructions
V->>S: Connect to SIP server
S->>P: INVITE (start call)
P->>S: 200 OK (call answered)
S->>V: Call established
V->>A: Initialize audio bridge
V->>O: Connect to OpenAI Realtime
O->>V: WebSocket connected
V->>O: Send generated instructions
loop During Call
P->>A: RTP audio packets
A->>A: Decode G.722/G.711 PCM
A->>O: Stream PCM audio
O->>O: Process speech text
O->>O: Generate AI response
O->>A: Stream AI audio (PCM)
A->>A: Encode PCM G.722/G.711
A->>P: RTP audio packets
Note over V: Monitor call progress<br/>& transcript logging
end
alt Call completed naturally
O->>V: Call completion signal
V->>S: Send BYE
else Duration limit reached
V->>V: Safety timeout triggered
V->>S: Send BYE
end
S->>P: BYE (end call)
P->>S: 200 OK
V->>U: CallResult{transcript, duration, success}
Before/After Example
Your simple input:
"Call Bocca di Bacco and book a table for 2 at 7pm tonight"
What o3-mini generates (excerpt):
## Personality and Tone
Identity: I am an assistant calling on behalf of John Doe to make a restaurant reservation.
Task: I am responsible for booking a table for 2 people at Bocca di Bacco today at 7:00 PM.
Tone: Professional, warm, and respectful.
## Instructions
1. Open the conversation immediately: "Hello, this is an assistant calling on behalf of John Doe."
2. Read back critical data: Repeat times and details for confirmation.
3. Handle objections: Respond politely and offer alternatives between 6-8 PM.
...
## Conversation States
[
{
"id": "1_greeting",
"description": "Greeting and introduction of call purpose",
"instructions": ["Introduce yourself as an assistant", "Immediately mention the reservation request"],
"examples": ["Hello, this is an assistant calling on behalf of John Doe. I'm calling to book a table for 2 people today at 7:00 PM."]
}
]
Automatic Adaptations
The o3-mini brief processor automatically:
- Detects language from your brief and generates instructions in that language
- Creates conversation flow with logical states and transitions
- Handles cultural context (German restaurants vs. American vs. Japanese)
- Generates appropriate examples with real phrases (no placeholders)
- Provides voicemail scripts for when nobody answers
- Plans for objections and alternative solutions
When to Use Each Approach
- Use
--brieffor 95% of calls - it's easier and produces better results - Use
--instructionsonly when you need very specific, custom behavior - Brief processing is perfect for: reservations, appointments, business calls, customer service
- Direct instructions are better for: highly specialized scenarios, testing, or when you've already perfected your prompt
Voice Selection
The AI agent supports 10 different voices from OpenAI's Realtime API, each with unique characteristics. By default, the system uses auto mode where o3-mini intelligently selects the optimal voice based on your call's context.
Available Voices
| Voice | Gender | Description | Best For |
|---|---|---|---|
| marin | Female | Clear, professional feminine voice | All-purpose: business calls, customer support, negotiations |
| cedar | Male | Natural masculine voice with warm undertones | All-purpose: professional calls, consultations, service interactions |
| alloy | Neutral | Professional voice with good adaptability | Technical discussions, business contexts, general inquiries |
| echo | Male | Conversational masculine voice | Casual to formal interactions, versatile tone |
| shimmer | Female | Warm, expressive feminine voice | Empathetic conversations, sales, professional contexts |
| coral | Female | Warm and friendly feminine voice | Customer interactions, consultations, support calls |
| sage | Neutral | Calm and thoughtful voice | Medical consultations, advisory roles, serious discussions |
| ash | Neutral | Clear and precise voice | Technical explanations, instructions, educational content |
| ballad | Female | Melodic and smooth feminine voice | Presentations, storytelling, engaging conversations |
| verse | Neutral | Versatile and expressive voice | Dynamic conversations, adaptable to any context |
Auto Voice Selection (Recommended)
The auto mode (default) uses o3-mini to analyze your call co