What is Kamailio?

Kamailio is a powerful, high-performance, and open-source SIP (Session Initiation Protocol) server used for building scalable and secure VoIP (Voice over IP) and real-time communication infrastructures. It is ideal for handling registration, authentication, call routing, presence, and NAT traversal, and is capable of managing thousands of concurrent calls.

Deploying Kamailio on Ubuntu 24.04 (Noble Numbat) ensures a modern and stable platform for real-time communication services, including SIP trunking, PBX front-end services, load balancing, IMS core components, and WebRTC signaling.


Core Features of Kamailio

SIP Proxy, Registrar, and Router

  • Acts as a SIP proxy, registrar, and redirect server.
  • Handles SIP registration, routing, authentication, and call forwarding.

Scalability and Performance

  • Designed for carrier-grade environments, handling tens of thousands of calls per second.
  • Can be distributed across multiple nodes using clustering and dispatcher modules.

Security and Access Control

  • Supports digest authentication, TLS, IP-based access control, and DoS protection.
  • Integrates with fail2ban, firewalls, and external RADIUS or Diameter servers.

NAT Traversal

  • Offers modules for NAT traversal (STUN, RTPProxy, MediaProxy, ICE).
  • Ensures proper call handling even when endpoints are behind NAT or firewalls.

Flexible Routing Logic

  • Highly customizable with its own scripting language (KEMI or native Kamailio script).
  • Logic based on SIP headers, database queries, or external APIs.

Database Integration

  • Connects to MySQL, PostgreSQL, SQLite, Redis, and NoSQL backends.
  • Stores registrations, location data, call routing tables, and accounting logs.

WebRTC Support

  • WebSocket module allows WebRTC signaling support in combination with media relays like Janus or RTPEngine.

High Availability and Load Balancing

  • Dispatcher module for load balancing across PBX or media servers.
  • Heartbeat and watchdog modules for HA clustering.

Why Use Kamailio on Ubuntu 24.04?

Ubuntu 24.04 provides:

  • Long-term support (LTS) with security updates until 2029.
  • Support for the latest kernel, libraries, and systemd improvements.
  • Excellent compatibility with VoIP toolchains like RTPProxy, Asterisk, FreeSWITCH, Janus, and RTPEngine.
  • Seamless integration with modern DevOps practices, Docker, and Kubernetes environments.

System Requirements for Kamailio on Ubuntu 24.04

ComponentMinimum Requirement
OSUbuntu 24.04 LTS
CPU1 core (multi-core recommended for HA)
RAM512 MB (2 GB or more recommended)
Disk~200 MB for binaries and configuration
Network Ports5060/UDP, 5060/TCP (SIP), 5061/TLS (optional), custom RTP ports for media
Dependencieslibssl, libmysqlclient, libpcre, etc.

Note: Kamailio itself handles signaling. Media (RTP) is relayed separately using tools like RTPProxy or RTPEngine.


Common Use Cases

  • SIP Trunking Gateways
  • Front-end SIP proxy for Asterisk, FreeSWITCH, or media servers
  • VoIP Load Balancer and Failover Engine
  • IMS Core Network Elements
  • WebRTC SIP Gateway
  • SIP-based Authentication and Routing for ISP/ITSPs
  • Custom VoIP Platforms and Softswitches

Kamailio vs Other SIP Servers

FeatureKamailioOpenSIPSAsteriskFreeSWITCH
TypeSIP signaling serverSIP signaling serverSIP PBX/media serverSIP PBX/media server
Handles RTP Media❌ No (external relay)❌ No✅ Yes✅ Yes
Call Routing Logic✅ Advanced (KEMI, script)✅ Advanced⚠️ Basic✅ Flexible
WebRTC Support✅ Yes (via WebSocket)✅ Yes⚠️ Limited✅ Yes
Scalability✅ Very high✅ Very high⚠️ Medium⚠️ Medium
Load Balancing✅ Yes✅ Yes❌ External only❌ External only
NAT Traversal✅ Yes✅ Yes✅ Yes✅ Yes
Best Use CaseHigh-scale SIP proxy/load balancerSimilar to KamailioSMB/Enterprise PBXMultimedia and conferencing systems

Security Recommendations

  • Use TLS for SIP signaling (port 5061).
  • Restrict access via firewall (UFW/iptables).
  • Use fail2ban to protect against brute-force SIP registration attacks.
  • Implement IP-based allowlists, authentication realms, and rate limiting.
  • Encrypt and secure database connections and sensitive variables.

Pros of Kamailio on Ubuntu 24.04

  • Extremely lightweight and fast.
  • High scalability for telecom and carrier-grade systems.
  • Scriptable and modular for advanced routing logic.
  • Active community and long-term stability.
  • Compatible with modern VoIP and cloud-native infrastructure.

Cons

  • Steeper learning curve for beginners.
  • No built-in media handling (requires external tools).
  • Complex setups may require knowledge of SIP internals, NAT traversal, and VoIP protocols.
  • Less suitable for small office PBX systems (better handled by Asterisk or FreeSWITCH).

Kamailio on Ubuntu 24.04 is an ideal solution for building scalable, secure, and flexible SIP-based communication systems. It’s suited for developers, service providers, and VoIP architects who need full control over signaling, authentication, and routing, and who want to run on a modern and long-term supported Linux platform.

Whether you’re building a SIP proxy, VoIP gateway, or WebRTC signaling service, Kamailio combined with Ubuntu 24.04 offers a powerful and reliable foundation.


Step 1: Create a VPS on Shape.Host

Before installing Kamailio, you need a server:

Go to https://shape.host and log in.

Click Create.

Choose Instance.

Shape.host Resources dashboard with Create > Instance highlighted.

Pick your preferred server location.

Shape.host instance form with the data center location selector highlighted.

Select Ubuntu 24.04 (64-bit) as the OS.

Choose a plan with at least 2 CPUs, 4 GB RAM, and 20 GB SSD.

Shape.host instance form with the operating system image selector highlighted.

Click Create Instance.

Shape.host instance form with the Create Instance button highlighted.

Find the IP address of your new instance in the Resources section.

Shape.host Resources dashboard with the server IP address highlighted.

Step 2: Connect to Your VPS

If you’re on Linux or macOS, open a terminal and run:

ssh root@your_server_ip

If you’re on Windows, use PuTTY:

  1. Open PuTTY.
  2. Enter your server IP in the “Host Name” field.
  3. Set Port to 22, Connection type to SSH, then click Open.
  4. Log in as root and enter your password.

Step 3: Update your package index

apt update

This refreshes the list of available software packages.

Terminal showing APT package management commands and output.

Step 4: Install MariaDB (MySQL-compatible)

apt install mariadb-server

Kamailio can use a database backend, so we install MariaDB for that.

Terminal showing APT package management commands and output.

Step 5: Add the Kamailio GPG key

wget -O- http://deb.kamailio.org/kamailiodebkey.gpg | apt-key add -

This lets your system trust Kamailio’s software repository.

Terminal showing file download commands and transfer output.

Step 6: Add the Kamailio repository for Ubuntu 24.04 (“noble”)

tee /etc/apt/sources.list.d/kamailio.list<<EOF
deb     http://deb.kamailio.org/kamailio60 noble main
deb-src http://deb.kamailio.org/kamailio60 noble main
EOF

Adds the official Kamailio 6.0 package source to your system.

Terminal showing tee commands or output during Add the Kamailio repository for Ubuntu 24.04 (noble).

Step 7: Update again to include Kamailio packages

apt update

Now your server knows where to get Kamailio.

Terminal showing APT package management commands and output.

Step 8: Install Kamailio with MySQL, TLS, and WebSocket modules

apt install kamailio kamailio-mysql-modules kamailio-websocket-modules kamailio-tls-modules

This installs the SIP server with support for MySQL DB, TLS encryption, and WebSocket connections.

Terminal showing APT package management commands and output.

Step 9: Verify Kamailio installation

kamailio -V

Displays the installed version of Kamailio.

Terminal showing gcc commands or output during Verify Kamailio installation.

Step 10: Configure Kamailio database settings

nano /etc/kamailio/kamctlrc

Uncomment or add the following values:

SIP_DOMAIN=srv1.example.com
DBENGINE=MYSQL
DBHOST=localhost

This tells Kamailio to use MySQL and defines the SIP domain.

Terminal showing mysql commands or output during Configure Kamailio database settings.

Step 11: Create the Kamailio database

kamdbctl create

This sets up the required tables and schema in your MariaDB database.

Terminal showing nano commands or output during Create the Kamailio database.

Step 12: Enable essential features in the main Kamailio config

nano /etc/kamailio/kamailio.cfg

Just below the line #!KAMAILIO, add:

#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_ACCDB

These enable MySQL backend, user authentication, location service, and accounting database.

Terminal showing the GNU nano editor and configuration text.

Step 13: Restart Kamailio

systemctl restart kamailio

Applies your changes and starts the SIP server.


Step 14: Check Kamailio status

systemctl status kamailio

Shows if the service is running correctly.

Terminal showing systemd service management commands or output.

You’ve installed and configured Kamailio SIP Server on Ubuntu 24.04 with MySQL support, WebSocket, TLS, and core SIP routing features.


This guide is written for servers deployed on Shape.Host, a reliable platform for real-time communication apps. You get:

  • Lightning-fast Linux SSD VPS provisioning
  • Root access and full control
  • Affordable and scalable cloud plans

Start hosting your VoIP infrastructure today at https://shape.host