Skip to main content
In this tutorial, you run the all-in-one Routr image and a PostgreSQL database with Docker Compose, create a SIP Domain and two Agents with the rctl command-line tool, register two softphones, and call from one to the other.

What you’ll build

A single Routr server on your machine with:
  • A Domain named sip.local.
  • Two Agents, 1001 (John) and 1002 (Jane), each with its own Credentials.
  • Two softphones registered to Routr that can call each other.
It takes about ten minutes.

Prerequisites

  • Docker with Docker Compose.
  • Node.js 22 or later and npm, to install rctl.
  • Two SIP softphones, for example Zoiper or Telephone. You can run them on the same computer or on two devices on the same network.
  • The IP address of the machine that runs Docker, as seen by your softphones (for example 192.168.1.3).

Steps

1

Write the configuration

Create a directory named routr. In it, add a file named routr.yaml with the following content. It is the one file Routr reads: the SIP transports, and the database where the Data API keeps your resources.
routr.yaml
Here’s what each part does:
  • externalAddrs is the address the EdgePort advertises in SIP messages. ${DOCKER_HOST_ADDRESS} reads it from the container’s environment. Use an address your softphones can reach.
  • transport opens SIP on port 5060 over UDP and TCP.
  • data stores resources in PostgreSQL. url and the API key come from the container’s environment, so the file holds no secret.
  • apiKeys is required: the Data API returns credentials and takes writes, so it refuses to listen beyond loopback without authentication. rctl sends the key with every request.
See routr.yaml for every key.
2

Start Routr

In the same directory, add a file named compose.yaml. It runs a PostgreSQL database, the migrations image, which creates the tables (Routr 2’s schema plus Routr 3’s numbering migrations), and fonoster/routr-one, which runs the EdgePort, Message Dispatcher, Connect processor, Location Service and Data API in one process.
compose.yaml
Port 51907 is the Data API, which rctl talks to. Port 5060 is SIP signaling. The db volume keeps the database between restarts.Pick an API key and export it, so both the container and rctl get it. Then start the stack, replacing 192.168.1.3 with your own IP address.
Then follow the logs until Routr is up:
Look for a line with msg="starting routr". Press Ctrl+C to stop following the logs; the server keeps running. If Routr stopped instead, its last line names the key of routr.yaml it couldn’t use.
Routr is running and listening for SIP on port 5060 and for API calls on port 51907.
3

Install rctl

Install the Routr command-line tool globally with npm:
Check that it’s installed:
Every command in this tutorial passes --insecure, because this Data API has no TLS. rctl connects to localhost:51907, the Data API’s port, by default, and reads the API key from ROUTR_API_KEY, which you exported in the same shell. To add TLS, see Secure the server.
4

Create a Domain

A Domain groups Agents that can call each other. Create one with the SIP URI sip.local:
Answer the prompts as shown. Leave the access control list set to None.
5

Create Credentials for both Agents

Credentials hold the username and password a softphone uses to register. Create the first set:
Use 1001 as the username and 1234 as the password:
Run the command again to create Jane Doe Credentials with username 1002 and password 1234.
6

Create two Agents

An Agent is a SIP endpoint, such as a softphone, that belongs to a Domain. Create John:
Select the sip.local Domain and John’s Credentials. Leave Max Contacts empty for no limit, and keep the other defaults.
Run the command again to create Jane Doe with username 1002 and Jane Doe Credentials.List the Agents to confirm both exist:
The output looks similar to this:
An empty Max Contacts means no limit. Add -x to also show each Agent’s reference.
You have a Domain and two Agents that can register and call each other.
7

Register the softphones

Add an account for 1001 in the first softphone and for 1002 in the second. Use these settings:sip.local doesn’t resolve in DNS, so the softphone must send its requests to Routr through the proxy setting. In Telephone, the account looks like this:Telephone account settings for 1001 with domain sip.local, username 1001, and a passwordAnd the proxy settings point at the Docker host:Telephone advanced settings with SIP address 1001@sip.local, registry server 192.168.1.2, and proxy 192.168.1.2 on port 5060
Both softphones show the account as registered (or online).
8

Make a call

From John’s softphone (1001), dial 1002. Jane’s softphone rings. Answer it and talk.To watch the SIP messages as the call happens, run sngrep on the Docker host. The Routr 3 image doesn’t include it.
You made an agent-to-agent call through Routr.

Clean up

Stop and remove the containers when you’re done. Add -v to also delete the database volume.

Troubleshooting

  • The softphone doesn’t register. Check that DOCKER_HOST_ADDRESS is an address the softphone can reach, and that the softphone’s proxy setting points at it on port 5060.
  • Registration works, but calls drop or don’t ring after a while on UDP. NAT devices close idle UDP mappings quickly. Lower the softphone’s re-register interval, or use TCP. See EdgePort cooperation for why connection-oriented transports are recommended.
  • rctl can’t connect. Make sure port 51907 is published and that you pass --insecure.
  • rctl reports authentication required. ROUTR_API_KEY in your shell isn’t the key the container started with. Export the same value and recreate the container with docker compose up -d.
  • The routr container exits at startup. Run docker compose logs routr. The last line names the file and the key at fault, such as spec.data.url: secret://env/DATABASE_URL: environment variable DATABASE_URL is not set.

Next steps

Set up a home or office

Add a Trunk and a Number so your Agents can call the PSTN.

Manage resources with rctl

Learn the commands for every Connect resource.

Architecture

See what happens inside Routr when a call arrives.

Deploy with Docker

Run Routr with Docker for a longer-lived setup.