Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Prerequisites

What to gather before installing Kanadr: a virtual machine, its network, a name and a certificate, a SIP trunk and an email server.

Virtual machine

Kanadr installs in one command on a Debian 13 VPS (see Installing on a VPS), or ships as a complete VM image: Debian 13, PostgreSQL, nginx and Kanadr with its telephony engine, ready to start (see Installing from the image).

HypervisorA Debian 13 VPS, at any provider (installer); KVM, Proxmox or OpenStack (qcow2 image); VMware or VirtualBox (OVA image).
CPU and memory2 vCPUs and 4 GB by default, up to 200 simultaneous calls; see Sizing.
Disk12 GB at least; the image grows on first boot to the size given. Plan more for call recordings and voicemail (about 1 MB per minute in 8 kHz WAV).
AccessA public SSH key, given on first boot through cloud-init: the image has no password. On a VPS, the one the provider installed.

For high availability, two identical VMs on the same network, plus a free IP address (the floating IP): see Active/passive.

Network

A fixed public IP address, preferably carried by the VM itself: phones and the trunk provider reach it.

Behind 1:1 address translation (NAT: a private address on the VM, the public address at the hosting provider or on the firewall), Kanadr must announce the public address, otherwise audio only flows one way. A single command sets it for the telephony engine and for the computer phone’s TURN server: sudo kanadr adresse-publique 203.0.113.10, then sudo systemctl restart kanadr-moteur (TURN follows by itself within a minute; see Commands). The image’s first boot and the VPS installer compare the machine’s address with the one seen from the Internet: if they differ, they announce “NAT détecté” (NAT detected) on the console and at SSH login, with the exact command to run; they do not apply it themselves, since a provider may do something other than 1:1 NAT.

  • Turn off the SIP ALG of the firewall or router in front of the VM: it rewrites SIP messages and breaks phone registration or audio.
  • Not supported: NAT that rewrites ports (the ports below must reach the VM unchanged) and double NAT.

Ports to open towards the VM (the image installs no firewall: filter upstream, or on the VM):

PortProtocolFor
443TCPPortal and API (HTTPS).
80TCPRedirect to HTTPS, and Let’s Encrypt certificate validation.
5060UDP and TCPSIP from phones and softphones (internal profile).
5061TCPSIP over TLS from softphones (internal profile).
5080UDP and TCPSIP from the trunk: SIP provider (external profile). Can be limited to the provider’s addresses.
16384 to 32768UDPAudio (RTP).
3478UDP and TCPTURN server of the computer phone (coturn): STUN and relay.
5349TCPTURN over TLS, for networks that only let TLS through.
40000 to 41999UDPTURN relay ports (KANADR_TURN_RELAIS).
22TCPAdministration (SSH), from your own addresses only.

Between the two VMs of an active/passive pair: VRRP (IP protocol 112), PostgreSQL (5432) and SSH (22).

Phone SIP is in clear on 5060 and over TLS on 5061, with the machine’s certificate, for the SIP phones of customers who choose encrypted calls (Settings). A phone that fails to authenticate too often gets its address banned (see Diagnostics): add your own addresses to the allow list right after installing.

The computer phone (browser or installed app) relays audio through the machine’s TURN server when the user’s network blocks direct UDP. On the image, it is set up at first boot with the machine’s name; installed from apt, set KANADR_TURN_HOTE in /etc/kanadr/kanadr.env, then restart Kanadr: it writes coturn’s configuration and restarts it. Behind address translation, TURN announces the address set with kanadr adresse-publique. It only relays to the machine itself and to public addresses, never to your internal network. Its TLS certificate is the portal’s: kanadr-certificat-sip gives it to TURN on the image, kanadr-certificat-turn CERTIFICATE KEY does otherwise (or as a certbot --deploy-hook).

The external profile also has TLS (5081): customers’ SIP connectors register over TLS with their service. These connections go out from the machine: port 5081 does not need to be open inbound.

Name and certificate

  • A fully qualified machine name (pbx.operator.example), with its DNS record pointing to the public address. It gives the portal address and the default domain.
  • A domain for customers, with a wildcard DNS record (*.pbx.operator.example) pointing to the instance: each customer has its SIP domain (customer.pbx.operator.example), which its phones register to. Set as the domain suffix, it saves entering the full domain for each customer.
  • A TLS certificate for the machine name, for the portal and SIP over TLS: the operator’s, or Let’s Encrypt (certbot). On first boot, the VM uses a self-signed certificate, to be replaced: softphones reject it.

SIP trunk

An account with a SIP provider for each customer that calls out: username and password, or IP address authentication. Calls between customers also go out through the trunk. See A customer’s trunk.

Email

An SMTP server (address, port, credentials, sender): invitations, password links, voicemail and alerts are sent by email. It is set in the portal, before creating the first users.

Optional

  • Voicemail transcription: a service compatible with OpenAI’s transcription API (online service, or a local engine: see Local transcription).
  • Configuration assistant: a Claude API key (Anthropic).
  • Monitoring: Prometheus, for the metrics and the alerts shipped (Monitoring).
  • Backups: storage outside the VM to copy the archives to (Backup).