Skip to content

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:

Preparing Your Repository

Create a GitHub repository containing your Dockerfile for Routr deployment.

Repository Structure

routr-deploy/
├── Dockerfile
├── config/
│ └── config.yml
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile in the root of your repository:

FROM fonoster/routr:latest
# Copy configuration
COPY config/ /etc/routr/
# Set environment variables
ENV ROUTR_EXTERN_ADDR=${EXTERN_ADDR}
ENV ROUTR_DS_PROVIDER=files
ENV ROUTR_DS_PARAMETERS=/etc/routr
# Expose ports
# 5060 - SIP UDP/TCP
# 5061 - SIP TLS
# 4567 - API
EXPOSE 4567
# The base image includes the default entrypoint

Creating Configuration

Create config/config.yml:

apiVersion: v1beta1
kind: Routr
metadata:
name: Main Server
spec:
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: 0

Environment Variables Reference

VariableRequiredDescription
EXTERN_ADDRYesExternal IP address for SIP signaling
ROUTR_DS_PROVIDERNoData source provider (default: files)

Deploying Routr on Klutch.sh

    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:

    • Select HTTP as the traffic type
    • Set the internal port to 4567 (API port)

    Set Environment Variables

    Add the following environment variables:

    VariableValue
    EXTERN_ADDRYour public IP or domain

    Attach Persistent Volumes

    Add the following volume:

    Mount PathRecommended SizePurpose
    /etc/routr1 GBConfiguration 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: v1beta1
kind: Domain
metadata:
name: sip.example.com
spec:
context:
domainUri: sip.example.com

Creating Agents

Define SIP agents (endpoints):

apiVersion: v1beta1
kind: Agent
metadata:
name: john
spec:
credentials:
username: john
secret: changeme
domains:
- sip.example.com

Creating Gateways

Configure SIP trunks:

apiVersion: v1beta1
kind: Gateway
metadata:
name: Provider
spec:
host: sip.provider.com
credentials:
username: account
secret: password

Using the API

List Agents

Terminal window
curl https://your-app.klutch.sh/api/v1beta1/agents

Register Status

Terminal window
curl https://your-app.klutch.sh/api/v1beta1/registry

Additional 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.