Skip to main content

Kamailio SIP edge (kamailio)

SIP edge of the Navin telephony: SIP over UDP, TCP and TLS for the carriers and the phones, WebSocket over TLS for the WebRTC softphones, anti-flood, anti-bruteforce, NAT handling, per tenant call limits and the dispatcher towards the Asterisk pools and LiveKit SIP. The tenant routing lives in hash tables filled by Navin Enterprise through JSONRPC and replicated by DMQ between the instances.

Generated from catalog/services/kamailio.yaml: do not edit by hand.

Summary​

Version5.7.4
Useinstall and configure
Layerfunctional (AI catalog)
CategoryNetwork
Installation methodspackage
External connectionno
Sandbox onlyno

Licence​

SPDX identifierGPL-2.0-or-later
Licence policylicence exception
Licence exceptionLEX-025 (pending, awaiting the client)
Licence noteGPL-2.0-or-later: a separate program reached through SIP and its JSONRPC interface; no Kamailio code is linked into Navin. The offline bundle redistributes the distribution packages with their notices and sources.
Platform componentkamailio

Packages and artifacts​

A package the project of the service publishes (its image, its binary archive, its Python or OS package) carries the licence of the service; a third-party package carries the licence written on its row, read from the official upstream metadata.

KindPackageVersionLicenceDetails
OS packagekamailioversion of the configured repositoryGPL-2.0-or-laterDebian family (apt)
OS packagekamailio-autheph-modulesversion of the configured repositoryGPL-2.0-or-laterDebian family (apt)
OS packagekamailio-tls-modulesversion of the configured repositoryGPL-2.0-or-laterDebian family (apt)
OS packagekamailio-websocket-modulesversion of the configured repositoryGPL-2.0-or-laterDebian family (apt)
OS packagepython3version of the configured repositoryPSF-2.0Debian family (apt)

Supported systems and architectures​

MethodOperating systemsArchitectures
packageDebian family (apt)x86_64, aarch64 (not restricted by the descriptor)
  • No package method on the RHEL family (dnf): No maintained Kamailio package exists in RHEL or EPEL 9 and 10: the RPM packages are published by the Kamailio project only (rpm.kamailio.org), a third party repository the offline bundle does not carry. Place the SIP edge on Ubuntu 24.04 (universe: Kamailio 5.7.4) or Debian 13 (Kamailio 6.0.1).
  • Method package on the Debian family (apt) limited to Ubuntu 24.04, Debian 13: Only Ubuntu 24.04 (5.7.4) and Debian 13 (6.0.1) ship a Kamailio the rendered configuration is validated against; Debian 12 (5.6.4) and Ubuntu 22.04 (5.5.4) lack the modules and parameters it uses.

Units of the distribution masked by the method package: kamailio.service. The postinst of the packages starts them with the stock configuration: right after the install the agent stops, disables and masks them (task systemd.mask, only when their unit file belongs to an installed package), and the component runs from its own unit navin-<service>-<component>.service. The uninstall only unmasks them.

Certified host systems: RHEL 8/9/10, Rocky Linux 8/9/10, AlmaLinux 8/9/10, Oracle Linux 8/9, CentOS Stream 9/10, Ubuntu 22.04/24.04, Debian 12, Arch Linux (rolling). The host preflight accepts these systems (other releases of a known family give a warning, end of life releases are refused) and the x86_64 and aarch64 architectures.

Prerequisites​

Host​

The descriptor declares no host preflight check.

Programs the commands and checks of the service start on the host, outside the managed roots: add them to allowed_commands of the agent (see Security of the Navin agent), else the agent refuses them with command_not_allowed: /usr/bin/python3, /usr/sbin/kamailio, /usr/sbin/kamcmd.

Network and ports​

ComponentPort namePortOpened in the host firewall
kamailiosip5060/udpyes
kamailiosip_tcp5060/tcpyes
kamailiosips5061/tcpyes
kamailiowss7443/tcpyes
kamailiojsonrpc5071/tcpyes
kamailiometrics5073/tcpyes
kamailiodmq5062/tcp (mode ha)yes

Services and connections needed​

Details and resolution: see Dependencies.

Installation methods and modes​

MethodDefaultWhat the method uses
packageyesthe OS packages of the descriptor, installed by the package manager of the host

Components​

ComponentKindInstallation methodsPorts
Kamailio (kamailio)masterpackage5060/udp, 5060/tcp, 5061/tcp, 7443/tcp, 5071/tcp, 5073/tcp, 5062/tcp (mode ha)

Single (single) (default)​

One SIP edge: a single point of failure for the calls.

What the mode deploys:

ComponentPlacement
kamailiomin 1, max 1

High availability (ha)​

Two or more active instances sharing their hash tables and call counters by DMQ; the carriers and phones reach them by DNS SRV, several addresses or a network load balancer.

What the mode deploys:

ComponentPlacement
kamailiomin 2, recommended 2

Install this service​

The install wizard of the Navin Manager plans, validates and runs the installation; you need the services:install permission on the cluster.

  1. Open the wizard. In Clusters, choose the row action Install services of the target cluster. The wizard opens on its first step, Service.

  2. Choose the service. On the Service step, select Kamailio SIP edge. The card shows the licence GPL-2.0-or-later and the dependencies the installation needs.

  3. Choose the hosts and the mode. On the Hosts step, tick the hosts, then choose the Mode: single (default), ha. Each mode deploys the components listed in Installation methods and modes.

  4. Bind the dependencies. On the Bindings step, choose for each dependency (asterisk, livekit_sip, rtpengine) Install with the platform or Use an existing connection; an optional dependency can stay on No binding.

  5. Configure. On the Configure step, review the parameters (see Configuration parameters). Passwords left empty with a generated default are generated and sealed by the Manager.

  6. Review and install. On the Install step the Manager validates the plan and shows the installation order; when it says "The plan is valid. Ready to install.", choose Install. A highly available mode is installed only when its HA checks pass.

  7. Verify. The operation ends when the health checks of every instance pass (see Health checks); the service then shows as running in Services.

High availability​

Clusternative (native)
High availabilitynative (native)
Failoverclient side (client)
Replicationnative (native)
Quorumnone (none)
Discoverystatic (static)
Entry pointclient discovery (client-discovery)
Official documentationhttps://www.kamailio.org/docs/modules/5.7.x/modules/dmq.html
Referenceshttps://www.kamailio.org/docs/modules/5.7.x/modules/dispatcher.html, https://www.kamailio.org/docs/modules/5.7.x/modules/htable.html, https://www.kamailio.org/docs/modules/5.7.x/modules/dialog.html
Peer authenticationDMQ has no authentication: the host firewall opens the DMQ port to the hosts of the cluster only and Kamailio refuses a KDMQ request that does not come from a known DMQ node (dmq_is_from_node). DMQ stays plain TCP even with TLS on.

Prerequisites​

PrerequisiteMust be highly availableModesDescription
asteriskyeshaA pool of two Asterisk nodes or more, so the dispatcher has a next active node for every tenant.

Topology per mode​

ModesHighest catalog levelDistributionQuorum componentFault domainsDescription
singlestandalone (standalone)single (single)-1One SIP edge: its loss stops every call and registration.
haha (ha)active-active (active-active)-2Active instances with the same hash tables (DMQ); the carriers and phones use another address when one is lost.

Notes​

  • Entry redundancy is outside Kamailio: DNS SRV records naming every instance, several signalling addresses declared at the carrier, or a network load balancer for SIP. A virtual IP is not universal (it needs a shared L2 segment or a cloud mechanism) and is not configured here.
  • DMQ replicates the hash tables and the dialog profiles (call counters per tenant), not the transactions nor the TCP, TLS and WebSocket connections: the dialogs routed by a lost instance fail on their next request (Record-Route names it), phones and softphones register again on another instance.
  • A restarted instance gets the tables of a running peer at start (dmq_init_sync); a whole restart empties them until Navin Enterprise reconciles (core.uptime).

Configuration parameters​

Network​

ParameterTypeDefaultAllowed valuesRequiredSecretRestartDescription
SIP port (sip_port)port5060-nonoyesSIP over UDP and TCP for the carriers and the phones (public).
SIP TLS port (tls_port)port5061-nonoyesSIP over TLS (public), bound while TLS is on.
WSS port (wss_port)port7443-nonoyesSIP over secure WebSocket for the WebRTC softphones of the portal (public), bound while TLS is on.
JSONRPC port (admin_port)port5071-nonoyesJSONRPC at /RPC (HTTPS while TLS is on) on the admin address. The host firewall opens it to the hosts of the cluster only and Kamailio answers 403 to any source outside the admin networks.
Metrics port (metrics_port)port5073-nonoyesPrometheus metrics at /metrics (xhttp_prom) on the admin address, apart from JSONRPC.
DMQ port (dmq_port)port5062-nonoyesReplication between the instances (KDMQ over TCP), opened to the hosts of the cluster only; Kamailio refuses a KDMQ request that does not come from a DMQ node. (ha)
SIP address (listen_address)string(empty)-nonoyesAddress the SIP, TLS and WSS listeners bind to; empty: the address of the host. (scope host)
Advertised address (advertised_address)string(empty)-nonoyesPublic address or name written in Via and Record-Route when the host is behind a 1:1 NAT; empty: none. (scope host)
Admin address (admin_address)string(empty)-nonoyesAddress of the JSONRPC and metrics listeners; empty: the address of the host. (scope host)

Security​

ParameterTypeDefaultAllowed valuesRequiredSecretRestartDescription
Admin networks (admin_networks)list[]-nononoCIDR networks allowed on JSONRPC besides the host itself, for example the addresses of the Navin Enterprise nodes (10.0.0.21/32); any other source gets 403.
Metrics networks (metrics_networks)list[]-nononoCIDR networks allowed on /metrics besides the host itself; empty: every source the host firewall lets in (the hosts of the cluster).
TLS (tls_enabled)booltrue-nonoyesSIP over TLS, WSS for the softphones and HTTPS on JSONRPC and the metrics, with the certificate issued by the Manager CA (key 0640 root and the kamailio group). Off: SIP over UDP and TCP and plain HTTP only, no softphone.
Public certificate (tls_public_cert_file)string(empty)-nononoPath of a certificate trusted by the browsers and the carriers (full chain, PEM) used instead of the Manager certificate; empty: the Manager certificate. (advanced)
Public certificate key (tls_public_key_file)string(empty)-nononoPath of the key of the public certificate, readable by the kamailio group. (advanced)
Carrier CAs (tls_client_ca_file)string/etc/ssl/certs/ca-certificates.crt-nononoCA bundle verifying the carriers reached over SIP TLS. (advanced)
Softphone secret (ephemeral_secret)passwordgenerated-noyesyesShared secret of auth_ephemeral, generated and kept in the Manager vault; Navin Enterprise reads it from the vault and gives the browser the user <expiry>:<extension> and the password base64(HMAC(secret, user)).
Softphone HMAC (ephemeral_algorithm)enumsha256sha1, sha256, sha384, sha512nonoyesHash of the HMAC of the ephemeral credentials (auth_ephemeral sha_algorithm).
Softphone credential lifetime (ephemeral_max_ttl_s)int3600min 60, max 86400nononoLongest validity accepted for ephemeral credentials, in seconds; an expiry further ahead is refused with 403.
Nonce secret (auth_nonce_secret)passwordgenerated-noyesyesSecret of the digest nonces (auth secret), shared by the instances so a challenge of one is valid on the others.
Failures before ban (ban_failures)int10min 2, max 1000nononoRefused authentications (401 or 407 with credentials, 403) of an external address before it is banned (table ipban).
Ban duration (ban_time_s)int900min 60, max 604800nononoSeconds an address stays in ipban after its last failure.
Flood threshold (pike_density)int30min 5, max 10000nononoRequests of one external address per 2 seconds before pike bans it (carriers and internal nodes are exempt).
Scanner user agents (scanner_user_agents)list["friendly-scanner", "sipvicious", "sipcli", "sip-scan", "VaxSIPUserAgent", "pplsip", "sundayddr", "iWar", "SIVuS", "smap"]-nononoUser-Agent fragments of known SIP scanners: their requests are dropped without answer and the source is banned.

Routing​

ParameterTypeDefaultAllowed valuesRequiredSecretRestartDescription
Internal transport (internal_transport)enumudpudp, tcpnonoyesTransport towards the Asterisk and LiveKit SIP nodes of the dispatcher.
Dedicated pools (dedicated_sets)json[]-nononoDispatcher sets of the dedicated pools: a list of {set (100 or more), destinations [host:port]}; Navin Enterprise routes a dedicated tenant to its set in tenant_domains and did_routes.
Probe interval (probe_interval_s)int10min 2, max 300nononoSeconds between two SIP OPTIONS probes of each destination.
Failed probes (probe_failures)int3min 1, max 20nononoFailed probes before a destination is marked down.
Successful probes (probe_successes)int2min 1, max 20nononoSuccessful probes before a destination is active again.
Destinations tried (dispatcher_attempts)int3min 1, max 10nononoDestinations of the set tried for one call (the tenant node first, then the next active ones on 408, 500 or 503).

Limits​

ParameterTypeDefaultAllowed valuesRequiredSecretRestartDescription
Default concurrent calls (default_max_calls)int0min 0nononoConcurrent calls of a tenant absent from tenant_limits; 0: no limit.
Default calls per second (default_cps)int0min 0nononoCalls per second of a tenant absent from tenant_limits; 0: no limit.
Dialog lifetime (max_call_duration_s)int14400min 60, max 86400nononoSeconds after which a dialog without BYE leaves the call counters.

Tuning​

ParameterTypeDefaultAllowed valuesRequiredSecretRestartDescription
Workers (workers)int8min 1, max 64nonoyesSIP worker processes per UDP listener and for TCP. (recommended max(4, min(32, host.cpu_count * 2)))
Maximum connections (max_connections)int4096min 64, max 200000nonoyesTCP, TLS and WebSocket connections at most.
Shared memory (MB) (shm_mb)int256min 64, max 16384nonoyesShared memory of Kamailio (transactions, dialogs, hash tables).
Private memory (MB) (pkg_mb)int16min 8, max 512nonoyesPrivate memory of each Kamailio process.
Log level (log_level)int2min -3, max 3nononoKamailio debug level: -3 alert to 3 debug, 2 info.

Dependencies​

For each active dependency the Manager takes the first of: the binding chosen in the wizard; a service of the same installation that provides it; a service already installed in the cluster; the only connection of the expected type. Otherwise an optional dependency stays unbound, and a required one is added to the installation in its default mode (the column below names the catalog service added).

BindingProvided byConnection typeEndpointOptionalWhen nothing is boundDescription
asteriskasterisk-sipnoasterisk is added to the installationShared Asterisk pool: every node is a destination of the dispatcher set 1, probed by SIP OPTIONS.
livekit_siplivekit-sip-sipyesstays unbound (optional)LiveKit SIP gateway: its nodes form the dispatcher set 2, the target of the numbers routed to the ai branch.
rtpenginertpengine-ngyesstays unbound (optional)Optional media relay: with it, Kamailio anchors the RTP of the calls that are not WebRTC (rtpengine_manage).

Endpoints​

EndpointSchemeComponentPortPathTLS parameterBinding parametersBinding secretsProvisioning command
sipsipkamailio5060 (sip_port)--transports, ephemeral_algorithmephemeral_secret-
sipssipskamailio5061 (tls_port)-tls_enabled---
wsswsskamailio7443 (wss_port)-tls_enabled---

Commands​

CommandComponentTargetDescription
Dispatcher destinations (dispatcher_list)kamailioevery hostLists the sets, destinations and states of the dispatcher (A active, I inactive, D disabled, P probed).
Drain a destination (dispatcher_state)kamailioevery hostSets the state of a destination on every instance: d drains it (disabled: no new call and no probe, the dialogs in progress end normally), a puts it back. A dispatcher reload or a restart brings every destination back.
Reload the dispatcher (dispatcher_reload)kamailioevery hostReloads dispatcher.list without restarting Kamailio.
Dump a hash table (htable_dump)kamailiofirst hostPrints the entries of one routing table (read only).
Uptime (uptime)kamailioevery hostcore.uptime of every instance: a restart empties the hash tables until Navin Enterprise reconciles them.
Validate the configuration (validate)kamailioevery hostRuns kamailio -c on the rendered configuration.

Command parameters​

CommandParameterTypeDefaultRequiredDescription
dispatcher_stateSet (set)int-yesDispatcher set (1 Asterisk, 2 LiveKit SIP, 100 or more dedicated).
dispatcher_stateDestination (destination)string-yesURI as listed, for example sip:pbx1.example.internal:5070.
dispatcher_stateState (state)enumdnod drains, a puts back.
htable_dumpTable (table)enumdid_routesnoHash table to print.

Health checks​

Liveness (per instance)​

ComponentCheckDetails
kamailioTCP {{ config.listen_address or host.ip or '127.0.0.1' }}:{{ config.sip_port }}20 retries; interval 1 s; timeout 3 s
kamailioHTTP {{ ('https://' ~ host.fqdn) if config.tls_enabled else ('http://' ~ (config.admin_address or host.ip or '127.0.0.1')) }}:{{ config.metrics_port }}/metricsExpected 200; Expected kamailio_; 20 retries; interval 1 s; timeout 3 s

Readiness (service check)​

CheckDetails
/usr/sbin/kamcmd -s unix:{{ paths.data }}/kamailio_ctl dispatcher.listExpected SET; 10 retries; interval 3 s; timeout 10 s

Preflight checks​

CheckTypeMeaningSeverityComponents
sip_port_freeport_free {"param": "sip_port"}port 5060 free on the hostblockingevery component
admin_port_freeport_free {"param": "admin_port"}port 5071 free on the hostblockingevery component

Backup and restore​

JSON export of the routing tables (tenant_domains, did_routes, trunk_hosts, tenant_limits) of the first instance through JSONRPC; the restore writes them back with htable.sets and htable.seti. Navin Enterprise stays the source of truth and reconciles them anyway; the transient ipban table is not kept.

Formatkamailio-htables
Componentkamailio
Files{{ backup.dir }}/htables.json
Restore testyes
Instances stopped for the restoreyes

Uninstall​

Paths removed when the data is purged: {{ paths.data }}, {{ paths.log }}.

Upstream documentation​