Deploying Routr
Introduction
Routr is a lightweight, open-source SIP proxy, registrar, and location server designed for modern VoIP deployments. Written in JavaScript/TypeScript, Routr provides a cloud-native approach to SIP infrastructure with easy configuration and deployment.
Key highlights of Routr:
- SIP Proxy: Route SIP traffic between endpoints
- Registrar: Handle SIP registration for devices
- Location Service: Track and locate registered endpoints
- REST API: Full API for configuration and management
- Cloud Native: Designed for containerized deployment
- Scalable: Horizontal scaling for high-availability
- TLS Support: Secure SIP with TLS encryption
- WebSocket Support: SIP over WebSocket for web clients
- Configuration as Code: YAML-based configuration
- Open Source: MIT licensed with active development
This guide walks through deploying Routr on Klutch.sh using Docker for your VoIP infrastructure.
Why Deploy Routr on Klutch.sh
Deploying Routr on Klutch.sh provides several advantages:
Simplified Deployment: Klutch.sh automatically builds and deploys Routr without complex SIP server configuration.
Persistent Storage: Attach persistent volumes for configuration that survives container restarts.
HTTPS by Default: Klutch.sh provides automatic SSL for secure API access.
Always-On Availability: Your SIP infrastructure remains available 24/7.
Environment Variable Management: Securely store credentials through Klutch.sh.
Prerequisites
Before deploying Routr on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your Routr configuration
- Understanding of SIP protocols
- Basic familiarity with Docker
Preparing Your Repository
Create a GitHub repository containing your Dockerfile for Routr deployment.
Repository Structure
routr-deploy/├── Dockerfile├── config/│ └── config.yml└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM fonoster/routr:latest
# Copy configurationCOPY config/ /etc/routr/
# Set environment variablesENV ROUTR_EXTERN_ADDR=${EXTERN_ADDR}ENV ROUTR_DS_PROVIDER=filesENV ROUTR_DS_PARAMETERS=/etc/routr
# Expose ports# 5060 - SIP UDP/TCP# 5061 - SIP TLS# 4567 - APIEXPOSE 4567
# The base image includes the default entrypointCreating Configuration
Create config/config.yml:
apiVersion: v1beta1kind: Routrmetadata: name: Main Serverspec: transport: - protocol: tcp port: 5060 - protocol: udp port: 5060 registrarIntf: Internal externAddr: ${EXTERN_ADDR} localnets: - 127.0.0.1/8 - 10.0.0.0/8 logging: traceLevel: 0Environment Variables Reference
| Variable | Required | Description |
|---|---|---|
EXTERN_ADDR | Yes | External IP address for SIP signaling |
ROUTR_DS_PROVIDER | No | Data source provider (default: files) |
Deploying Routr on Klutch.sh
- Select HTTP as the traffic type
- Set the internal port to 4567 (API port)
Push Your Repository to GitHub
Commit and push your Dockerfile and configuration to GitHub.
Create a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a new project with a descriptive name like “routr” or “sip-server”.
Create a New App
Within your project, create a new app. Connect your GitHub account and select the repository containing your Routr Dockerfile.
Configure HTTP Traffic
In the deployment settings:
Set Environment Variables
Add the following environment variables:
| Variable | Value |
|---|---|
EXTERN_ADDR | Your public IP or domain |
Attach Persistent Volumes
Add the following volume:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/etc/routr | 1 GB | Configuration and data |
Deploy Your Application
Click Deploy to start the build process.
Access Routr API
Once deployment completes, access the Routr API at your app URL.
Configuration
Creating Domains
Define SIP domains in your configuration:
apiVersion: v1beta1kind: Domainmetadata: name: sip.example.comspec: context: domainUri: sip.example.comCreating Agents
Define SIP agents (endpoints):
apiVersion: v1beta1kind: Agentmetadata: name: johnspec: credentials: username: john secret: changeme domains: - sip.example.comCreating Gateways
Configure SIP trunks:
apiVersion: v1beta1kind: Gatewaymetadata: name: Providerspec: host: sip.provider.com credentials: username: account secret: passwordUsing the API
List Agents
curl https://your-app.klutch.sh/api/v1beta1/agentsRegister Status
curl https://your-app.klutch.sh/api/v1beta1/registryAdditional Resources
Conclusion
Deploying Routr on Klutch.sh gives you a modern, cloud-native SIP server with automatic builds and persistent storage. Whether building a VoIP platform, connecting SIP trunks, or managing SIP endpoints, Routr on Klutch.sh provides the foundation for scalable voice infrastructure.