An AI-powered conversation server that handles incoming phone calls using Amazon Nova Sonic in Amazon Bedrock. The server can access a customized Amazon Bedrock knowledge base for company-specific information. A flexible solution for businesses that need AI-powered phone conversation handling.
- Incoming Call: A caller dials your business number. Your VoIP provider (like Twilio, Vonage, or your SIP trunk provider) receives the call and routes it to your Nova Sonic server using the SIP protocol. You configure your provider to send calls to
sip:service@your-server-ip:5060 - AI Conversation: Amazon Nova Sonic handles the conversation naturally using your custom prompt
- Knowledge Access: The AI can query your knowledge base for accurate information
- Call Recording: All conversations are automatically recorded and transcribed
- Dashboard Review: Use the web dashboard to review calls, analyze conversations, and adjust settings
- SIP Server: Full SIP call management with RTP audio handling
- AI Conversation Handler: Nova Sonic in Amazon Bedrock handles natural conversation
- Configuration Dashboard: Configure tools to connect to your knowledge base
- Call Recording: Complete call audio with conversation transcripts
- Replay Dashboard: Real-time monitoring and call playback
- Call Analysis: AI-powered call analysis and summaries
- Multi-call Support: Handle concurrent incoming calls
nova-sonic-sp-server/
├── src/
│ ├── ai/ # AI providers and tools
│ │ ├── nova/ # AWS Bedrock Nova Sonic
│ │ │ ├── NovaProvider.js # Main Nova Sonic implementation
│ │ │ └── NovaPrompts.js # Default conversation prompts
│ │ ├── tools/ # AI tool integrations
│ │ │ ├── KnowledgeBaseTool.js # Bedrock Knowledge Base integration
│ │ │ └── ToolManager.js # Tool orchestration
│ │ └── AIProvider.js # Base provider class
│ ├── analyzer/ # Call analysis components
│ │ └── BedrockCallAnalyzer.js # AI-powered call analysis
│ ├── audio/ # Audio processing components
│ │ ├── AudioInputHandler.js # RTP input processing
│ │ ├── AudioOutputHandler.js # RTP output handling
│ │ └── MeetingRecorder.js # Call recording
│ ├── core/ # Core business logic
│ │ ├── Meeting.js # Call management
│ │ ├── UserSession.js # User session handling
│ │ ├── RouteManager.js # Routing configuration
│ │ └── ConfigManager.js # Configuration management
│ ├── sip/ # SIP protocol handling
│ │ ├── SIPHandler.js # SIP message processing
│ │ ├── SIPServer.js # Main SIP server implementation
│ │ └── CodecManager.js # Codec negotiation
│ ├── utils/ # Utility functions
│ │ ├── audioTools.js # Audio conversion utilities
│ │ ├── commons.js # Common utilities
│ │ ├── rtpUtils.js # RTP packet handling
│ │ └── logger.js # Structured logging
│ ├── configs.js # Configuration constants
│ ├── main.js # Application entry point
│ └── DashboadServer.js # Dashboard HTTP server
├── dashboard/ # Web monitoring dashboard
│ ├── src/ # React/TypeScript application source
│ ├── dist/ # Built dashboard assets
│ ├── package.json # Dashboard dependencies
│ └── server.js # Dashboard backend server
├── assets/ # Static assets
│ └── start.wav # Initial audio file
├── test/ # Test suite
│ ├── integration/ # Integration tests
│ ├── unit/ # Unit tests
│ └── reports/ # Test reports
├── config.json # AI configuration file
├── routes.yaml # Call routing configuration
├── .env.example # Environment variables template
└── package.json # Main dependencies
- Node.js 24+
- AWS credentials for Amazon Nova Sonic in Amazon Bedrock
- Public IP address for SIP connectivity
Create a .env file in the project root:
# Network Configuration (Required for public deployments)
SIP_IP=your_public_ip # Public IP for SIP signaling
RTP_IP=your_public_ip # Public IP for RTP media
SIP_PORT=5060 # SIP signaling port (UDP)
HTTP_PORT=3001 # Dashboard HTTP port
FIRST_RTP_PORT=10000 # Start of RTP port range
LAST_RTP_PORT=10005 # End of RTP port range
# AI Configuration
AWS_REGION=us-east-1 # AWS region for Bedrock Nova
# AWS credentials via IAM role or environment variables
# Output Configuration
OUTPUT_PATH=./output # Call recording output directory
LOG_LEVEL=debug # Logging level (debug, info, warn, error)The web dashboard provides an easy way to configure the AI system:
- System Prompt: Customize how the AI behaves and responds
- Knowledge Base: Connect to your Amazon Bedrock Knowledge Base for company-specific information
- Test Panel: Validate your configuration before going live
Configuration is automatically saved to config.json and takes effect immediately.
By default, all calls use the same AI configuration. For advanced users who need different AI behavior for different phone numbers, you can create custom routing in routes.yaml:
"+15551234567":
alias: main-line
provider: NovaProvider
"+15559876543":
alias: sales-line
provider: CustomSalesProvider
default:
provider: NovaProviderFor local development and testing (dashboard only - SIP calls require public deployment):
- Install dependencies:
npm install
cd dashboard && npm install && cd ..- Configure environment:
cp .env.example .env
# Edit .env with your AWS credentials and configuration- Build and start:
cd dashboard && npm run build && cd ..
npm start- Access the dashboard:
http://localhost:3001
Note: For actual phone calls, you need to deploy to a server with a public IP address.
-
Launch EC2 Instance:
- Use Amazon Linux 2 or Ubuntu 20.04+
- Instance type: t3.medium or larger (for real-time audio processing)
- Assign a public IP address
-
Configure Security Group:
- SIP Port: 5060/udp (from your VoIP provider's IP ranges) - RTP Ports: 10000-10005/udp (from anywhere: 0.0.0.0/0) - Dashboard: 3001/tcp (from your IP only - see security notes below) - SSH: 22/tcp (from your IP) -
Set up IAM Role with Bedrock permissions:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "bedrock:InvokeModelWithBidirectionalStream", "bedrock:InvokeModel" ], "Resource": [ "arn:aws:bedrock:*::foundation-model/amazon.nova-sonic-v1:0" ] }, { "Effect": "Allow", "Action": ["bedrock:Retrieve"], "Resource": [ "arn:aws:bedrock:*:YOUR_ACCOUNT_ID:knowledge-base/*" ] } ] } -
Deploy Application:
# Upload your code to the server git clone <your-repo-url> cd nova-sonic-sp-server # Configure environment cp .env.example .env # Edit .env with your public IP and AWS region # Install dependencies and build dashboard cd dashboard && npm install && npm run build && cd .. # Install dependencies for SIP server cd src && npm install # Start the service npm start
Dashboard Access: Restrict port 3001 to your IP only:
- AWS Security Group: Add rule
3001/tcpfromYOUR_IP/32 - Find your IP:
curl ifconfig.me - Update security group when your IP changes
Required Public Ports: RTP ports (10000-10005/UDP) must remain open to 0.0.0.0/0 for voice calls to work properly.
The server implements a full SIP stack that handles incoming phone calls using standard SIP/RTP protocols.
- SIP Signaling: Handles call setup, routing, and teardown on port 5060 (UDP)
- RTP Audio: Streams real-time audio between caller and AI on ports 10000-10005 (UDP)
- Codec Support: Uses PCMU (G.711 μ-law) for reliable audio quality
- NAT Handling: Automatically handles NAT traversal and public IP routing
Configure your SIP provider to route calls to: sip:service@your-server-ip:5060
Compatible with:
- VoIP Providers: Vonage, Twilio, Bandwidth, Flowroute
- PBX Systems: Asterisk, FreeSWITCH, 3CX
- SIP Trunking: Most standard SIP trunk providers
Network Requirements:
- Public IP address for your server
- UDP ports 5060 (SIP) and 10000-10005 (RTP) open in firewall
- Proper NAT configuration if behind a router
- Start the Service:
npm start - Monitor via Dashboard:
http://your-server-ip:3001 - Configure Tools and AI Prompt: Edit the prompt and tool configuration from the dashboard
- Incoming Calls: Callers connect directly to AI conversation handler
- Call Handling: Nova Sonic handles conversation naturally
- Call Recording: All calls are automatically recorded and transcribed
- Call Analysis: Review call summaries and insights via dashboard
Call recordings and transcripts are saved to the configured OUTPUT_PATH:
output/
└── YYYY-MM-DD_HH-MM-SS_call-id/
├── call-id_recording.wav # Call audio recording
├── call-id_metadata.json # Call metadata and details
└── transcripts.txt # Conversation transcripts
Access the web dashboard at http://your-server:3001 to manage your AI phone system.
- System Prompt: Customize how the AI behaves and responds to callers
- Knowledge Base: Connect to Amazon Bedrock Knowledge Base for company information
- Test Panel: Validate your configuration before going live
- Call History: Browse and search all recorded calls
- Audio Playback: Listen to calls with multi-channel audio controls
- Live Transcripts: View real-time conversation transcripts with timestamps
- Waveform Visualization: Visual audio timeline for easy navigation
- AI Analysis: Get automated call summaries and insights
