Skip to content

loreste/siprec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SIPREC Server

Go Version License Documentation Build Status NAT Support TCP Optimized

A high-performance, enterprise-grade SIP recording (SIPREC) server that implements RFC 7865/7866 with custom TCP-optimized transport, advanced real-time transcription capabilities, and comprehensive NAT support for cloud deployments.

✨ Key Features

Core SIPREC Capabilities

  • 📞 RFC Compliance - Complete RFC 7865/7866 implementation for SIP session recording
  • 🔄 Session Management - Advanced session lifecycle management with failover support
  • 🎯 NAT Traversal - Comprehensive NAT support with STUN integration for cloud deployments
  • 🔗 SIP Integration - Custom SIP server implementation optimized for TCP transport and large metadata

Transcription & Processing

  • 🎙️ Real-time Transcription - Enhanced multi-provider STT with streaming capabilities (Google, Deepgram, OpenAI, Azure)
  • 👥 Speaker Diarization - Multi-speaker identification and word-level speaker tagging
  • 🎵 Audio Processing - Advanced VAD, noise reduction, and multi-channel mixing
  • 🌐 WebSocket Streaming - Real-time transcription delivery with circuit breaker patterns
  • 📊 Quality Metrics - Audio quality monitoring and adaptive processing with performance optimization

Enterprise Features

  • 🔐 Security - End-to-end encryption with TLS/SRTP and configurable key rotation
  • 📨 Message Queue - AMQP integration with delivery guarantees and circuit breakers
  • 📈 Monitoring - Comprehensive metrics, health checks, and operational visibility
  • ☁️ Cloud Ready - Optimized for GCP, AWS, Azure with automatic configuration

🚀 Quick Start

Cloud Deployment (Recommended)

Google Cloud Platform

# One-command deployment
./deploy-quick.sh

# Or with Terraform
terraform init
terraform apply -var="project_id=YOUR_PROJECT_ID"

Manual Linux Installation

# Download and run deployment script
wget https://raw.githubusercontent.com/loreste/siprec/main/deploy_gcp_linux.sh
chmod +x deploy_gcp_linux.sh
sudo ./deploy_gcp_linux.sh

Docker Deployment

# Production deployment
docker run -d \
  --name siprec-server \
  --restart unless-stopped \
  -p 5060:5060/udp \
  -p 5060:5060/tcp \
  -p 5061:5061/udp \
  -p 8080:8080 \
  -v $(pwd)/recordings:/var/lib/siprec/recordings \
  -v $(pwd)/config:/etc/siprec \
  -e BEHIND_NAT=true \
  -e EXTERNAL_IP=auto \
  ghcr.io/loreste/siprec:latest

Development Setup

# Clone repository
git clone https://github.com/loreste/siprec.git
cd siprec

# Build from source
go build -o siprec ./cmd/siprec

# Run with default configuration
./siprec

⚙️ Configuration

Environment Variables

The server can be configured via environment variables or a .env file:

# Network Configuration (NAT Optimized)
BEHIND_NAT=true                    # Enable NAT support
EXTERNAL_IP=auto                   # Auto-detect external IP
INTERNAL_IP=auto                   # Auto-detect internal IP
PORTS=5060,5061                    # SIP listening ports
RTP_PORT_MIN=16384                 # RTP port range start
RTP_PORT_MAX=32768                 # RTP port range end

# STUN Configuration
STUN_SERVER=stun:stun.l.google.com:19302

# Security
ENABLE_TLS=true                    # Enable TLS for SIP
TLS_CERT_PATH=/path/to/cert.pem    # TLS certificate
TLS_KEY_PATH=/path/to/key.pem      # TLS private key
ENABLE_SRTP=true                   # Enable SRTP for media

# Transcription
STT_DEFAULT_VENDOR=google          # STT provider
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json

# Recording
RECORDING_DIR=/var/lib/siprec/recordings
RECORDING_MAX_DURATION=4h
ENABLE_RECORDING_ENCRYPTION=false

# STT Provider
STT_PROVIDERS=google-enhanced  # Enhanced providers: google-enhanced, deepgram-enhanced, openai, azure
STT_ENABLE_DIARIZATION=true    # Enable speaker diarization
STT_ENABLE_WORD_TIMESTAMPS=true # Enable word-level timestamps

# Audio Processing
VAD_ENABLED=true
NOISE_REDUCTION_ENABLED=true

For detailed configuration, see Configuration Guide.

📖 Documentation

Comprehensive documentation is available in the docs directory:

🏗️ Architecture

SIPREC Server is built with a modular architecture:

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   SIP/RTP   │────▶│   Audio     │────▶│     STT     │
│   Handler   │     │ Processing  │     │  Provider   │
└─────────────┘     └─────────────┘     └─────────────┘
                            │                    │
                            ▼                    ▼
                    ┌─────────────┐     ┌─────────────┐
                    │  Recording  │     │ WebSocket/  │
                    │   Storage   │     │    AMQP     │
                    └─────────────┘     └─────────────┘

🔌 API Endpoints

HTTP API

  • GET /health - Health check endpoint
  • GET /health/live - Kubernetes liveness probe
  • GET /health/ready - Kubernetes readiness probe
  • GET /metrics - Prometheus metrics
  • GET /api/sessions - Active sessions
  • GET /api/sessions/stats - Session statistics

WebSocket

  • WS /ws/transcriptions - Real-time transcription stream

🧪 Testing

Validate Installation

# Check service status
systemctl status siprec-server

# Test health endpoint
curl http://localhost:8080/health

# Test SIP response
echo -e "OPTIONS sip:test@localhost SIP/2.0\r\nVia: SIP/2.0/UDP test:5070\r\nFrom: sip:test@test\r\nTo: sip:test@localhost\r\nCall-ID: test\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n" | nc -u localhost 5060

NAT Configuration Test

# Run comprehensive NAT testing
./test_nat_config.sh

# Check NAT detection
curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/external-ip

Load Testing

# Run test suite
go test -v ./...

# Run E2E tests
./run_test.sh

# SIPREC simulation
./test/e2e/siprec_simulation_test.go

🏢 Production Deployment

System Requirements

  • OS: Ubuntu 20.04+, Debian 11+, CentOS 8+, RHEL 8+
  • Memory: 4GB RAM minimum, 8GB recommended
  • CPU: 2 cores minimum, 4 cores recommended
  • Storage: 50GB minimum for recordings
  • Network: Public IP for external access

Performance Characteristics

  • Concurrent Sessions: 100+ simultaneous recordings
  • Audio Quality: PCM/G.711/G.722 codec support
  • Latency: <100ms for real-time transcription
  • Throughput: 1000+ RTP packets/second per session

High Availability Setup

# Multiple instances with load balancer
# Session state stored in external database
# Shared storage for recordings
# AMQP clustering for message reliability

Monitoring & Alerting

# Prometheus metrics
curl http://localhost:8080/metrics

# Key metrics to monitor:
# - siprec_active_calls
# - siprec_rtp_packets_received
# - siprec_transcription_errors
# - siprec_session_duration

🔧 Administration

Service Management

# SystemD commands
sudo systemctl start siprec-server
sudo systemctl stop siprec-server
sudo systemctl restart siprec-server
sudo systemctl status siprec-server

# View logs
sudo journalctl -u siprec-server -f

# Configuration reload
sudo systemctl reload siprec-server

Troubleshooting

# Check configuration
./siprec envcheck

# Test connectivity
netstat -tulpn | grep 5060

# Debug NAT issues
./test_nat_config.sh

# View detailed logs
tail -f /var/log/siprec/siprec.log

🌟 Use Cases

Contact Centers

  • Call Recording: Automatic SIPREC-compliant call recording
  • Quality Assurance: Real-time transcription for agent monitoring
  • Compliance: Regulatory compliance with complete audit trails

Enterprise Communications

  • Meeting Recording: Conference call recording and transcription
  • Training: Call analysis and training material generation
  • Analytics: Voice analytics and sentiment analysis

Telecommunications

  • Service Provider: SIPREC recording for telecom operators
  • Legal Compliance: Lawful intercept and recording capabilities
  • Network Analysis: Call quality and performance monitoring

📊 Comparison

Feature SIPREC Server Commercial Solutions Open Source Alternatives
RFC Compliance ✅ Full RFC 7865/7866 ✅ Yes ⚠️ Limited
Real-time Transcription ✅ Multi-provider ✅ Yes ❌ No
NAT Support ✅ Advanced ✅ Yes ⚠️ Basic
Cloud Ready ✅ Optimized ✅ Yes ⚠️ Manual
Cost ✅ Open Source ❌ Expensive ✅ Free
Customization ✅ Full Control ❌ Limited ✅ Yes

🤝 Contributing

We welcome contributions from the community! Please see our Contributing Guide for details.

Development Setup

# Clone and setup
git clone https://github.com/loreste/siprec.git
cd siprec

# Install dependencies
go mod download

# Run tests
go test -v ./...

# Build
go build -o siprec ./cmd/siprec

Coding Standards

  • Follow Go best practices and idioms
  • Write comprehensive tests for new features
  • Update documentation for user-facing changes
  • Use conventional commit messages

📄 License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

🆘 Support

Documentation

Community Support

Professional Support

For enterprise support, custom development, or consulting services, please contact us through the repository.


Built with ❤️ for the VoIP and telecommunications community

About

OpenSource SIPREC server written ing Golang by Lance Oreste

Resources

License

Stars

Watchers

Forks

Packages

No packages published