A production-ready FreeSWITCH Docker deployment with web UI, SSL/TLS support, and LiveKit cloud integration for AI-powered call handling.
- FreeSWITCH PBX: Complete SIP telephony server running in Docker
- Web Management UI: Secure HTTPS control panel for system management
- LiveKit Integration: Ready for AI agent voice calls with natural ring simulation
- SSL/TLS Security: Let's Encrypt certificate with auto-renewal
- PostgreSQL Database: For configuration and call records
- Call Recording: Automatic recording of all calls
- Ring Simulation: 2-5 seconds random ring before AI answers
┌─────────────────┐ ┌──────────────┐ ┌─────────────────┐
│ Incoming │────▶│ FreeSWITCH │────▶│ LiveKit Cloud │
│ SIP Calls │ │ (Docker) │ │ AI Agents │
└─────────────────┘ └──────────────┘ └─────────────────┘
│
▼
┌──────────────┐
│ Web UI │
│ (HTTPS) │
└──────────────┘
- Docker & Docker Compose installed
- Domain name (using ladgig.com)
- LiveKit Cloud account
- Clone the repository:
git clone https://github.com/yourusername/freeswitch-proxy.git
cd freeswitch-proxy- Configure LiveKit credentials:
Edit
configs/vars.xmland update:
<X-PRE-PROCESS cmd="set" data="livekit_cloud_host=your-app.livekit.cloud"/>
<X-PRE-PROCESS cmd="set" data="livekit_cloud_api_key=YOUR_API_KEY"/>
<X-PRE-PROCESS cmd="set" data="livekit_cloud_api_secret=YOUR_API_SECRET"/>- Start services:
# Start FreeSWITCH and database
docker-compose -f docker-compose.fusionpbx.yml up -d
# Start secure web UI
docker-compose -f docker-compose.secure-ui.yml up -d- Access Web UI:
- URL: https://ladgig.com
- Username:
admin - Password:
Admin2025!
freeswitch/
├── configs/ # FreeSWITCH configuration files
│ ├── dialplan/ # Call routing rules
│ │ ├── ivr.xml # IVR configuration
│ │ └── livekit-ai-agent.xml # AI agent routing
│ ├── sip_profiles/ # SIP endpoints
│ │ ├── internal.xml # Internal profile (5060)
│ │ ├── external.xml # External profile (5080)
│ │ └── livekit.xml # LiveKit profile (5061)
│ ├── scripts/ # Lua call handling scripts
│ │ └── ai_agent_handler.lua # AI agent call flow
│ └── vars.xml # Global variables & settings
├── docker/ # Docker build files
│ └── Dockerfile # FreeSWITCH container
├── simple-webui/ # Web management interface
│ └── index.php # Control panel
├── ssl/ # SSL certificates
├── scripts/ # Utility scripts
│ ├── renew-ssl.sh # SSL renewal script
│ └── generate-ssl.sh # Certificate generation
├── docker-compose.yml # Main services
├── docker-compose.secure-ui.yml # HTTPS web UI
└── nginx-ssl.conf # Nginx HTTPS configuration
- Provider: Let's Encrypt (trusted CA)
- Domain: ladgig.com
- Auto-renewal: Daily check at 3 AM
- Valid until: November 3, 2025
- HTTPS enforced (HTTP auto-redirects)
- Secure admin credentials
- PostgreSQL database isolated in Docker network
- FreeSWITCH ESL password protected
- Incoming Call → FreeSWITCH receives on SIP port 5060/5080
- Ring Simulation → 2-5 seconds random ring tone
- Auto Answer → Call answered automatically
- LiveKit Bridge → Connected to AI agent in cloud
- Recording → Entire call recorded to WAV file
- Internal: Port 5060 (for extensions)
- External: Port 5080 (for trunks)
- LiveKit: Port 5061 (for WebRTC)
- RTP Ports: 16384-32768
- Type: PostgreSQL 13
- Database: fusionpbx
- User: fusionpbx
- Internal Access Only
- Automatic room creation per call
- UUID-based room naming
- OPUS codec support
- WebRTC compatible
# View running containers
docker ps
# Check FreeSWITCH status
docker exec freeswitch-server fs_cli -x "status"
# View active calls
docker exec freeswitch-server fs_cli -x "show calls"
# Check logs
docker-compose logs -f freeswitch# Restart FreeSWITCH
docker restart freeswitch-server
# Restart Web UI
docker restart freeswitch-webui-secure
# Restart Nginx
docker restart nginx-ssl-proxyAccess https://ladgig.com to view:
- FreeSWITCH status
- Database connection
- System information
- Active calls
- Extensions
curl https://ladgig.com/api-status.phpReturns JSON with service status.
Automatic via cron, or manual:
./scripts/renew-ssl.sh# Backup PostgreSQL
docker exec fusionpbx-db pg_dump -U fusionpbx fusionpbx > backup.sql
# Backup configurations
tar -czf configs-backup.tar.gz configs/docker-compose pull
docker-compose up -d- Check RTP ports in firewall
- Verify NAT settings in vars.xml
- Test with local extension first
- Verify API credentials in vars.xml
- Check network connectivity
- Review FreeSWITCH logs
- Check nginx-ssl-proxy is running
- Verify SSL certificate is valid
- Check port 443 is open
credentials-freeswitch.md- All system credentials (git-ignored)configs/vars.xml- Main configuration variablesconfigs/livekit-cloud.conf- LiveKit settings.env- Environment variables
LIVEKIT-SETUP-GUIDE.md- LiveKit integration guideCLAUDE.md- Development context- This README
| Service | Port | Purpose |
|---|---|---|
| HTTP | 80 | Redirects to HTTPS |
| HTTPS | 443 | Web UI (secure) |
| SIP Internal | 5060 | Internal extensions |
| SIP External | 5080 | External trunks |
| SIP LiveKit | 5061 | LiveKit integration |
| ESL | 8021 | Event Socket Layer |
| RTP | 16384-32768 | Media/Audio |
- Create SIP trunk pointing to
ladgig.com:5080 - Configure AI agent to join rooms with prefix
ai-room-* - Set agent participant name as
ai-agent - Enable OPUS codec
- Configure webhook for call events (optional)
This project uses FreeSWITCH (MPL 1.1 License) and various open-source components.
For issues or questions:
- Check logs:
docker-compose logs - Review FreeSWITCH CLI:
docker exec -it freeswitch-server fs_cli - Verify services: https://ladgig.com/api-status.php
- Check documentation in
/docsfolder
Last Updated: August 6, 2025 Version: 1.0.0 Domain: ladgig.com