Welcome to the third and final installment of our “Debian 13 Packaging & Distribution” series. In the previous parts, we set up our GPG-signed APT repository and compiled the Telephony Server telephony core. Now, we will compile and package Kamailio (v6.1), the high-performance SIP routing engine, from source on Debian 13. Finally, we will publish the resulting modular packages to our custom repository server and perform an end-to-end client installation.
While Debian provides pre-compiled Kamailio packages in its upstream repositories, they are often lagging behind the latest stable upstream branch or missing custom modules. Compiling Kamailio on our own build node gives us:
Access to the Latest Features: Target the stable 6.1 upstream branch.
Custom Modules: Build only the modules we require (e.g., PostgreSQL support, JSON/JWT processing, WebSockets, or TLS).
Optimization: Compile binaries compiled specifically for your deployment target’s processor architecture (e.g., AMD64 vs. ARM64).
Kamailio has a modular architecture. In order to build database, presence, secure transport, and logging modules, we must install their corresponding development packages.
We clone Kamailio into /usr/src/kamailio/src. This isolates our build directories and outputs the packaged files in the parent directory (/usr/src/kamailio/), keeping our source tree clean.
# Add a new custom changelog version entry using dch (use -b to force version check override)
DEBEMAIL="[EMAIL_ADDRESS]"DEBFULLNAME="[YOUR_FULL_NAME]"dch-b-v"${CURRENT_VER}-0+sbc""Custom compile with sbc-kamailio package rename"
[!TIP]
Handling Version Mismatches & Warnings (dch warning):
If you specify a static version (e.g., 6.1.0-0+sbc) and dch warns that new version is less than the current version number (6.1.4), the source branch contains newer maintenance updates. Always use the extracted ${CURRENT_VER} or match the exact upstream version (e.g., 6.1.4-0+sbc) to prevent package downgrade conflicts in APT.
[!NOTE]
Debian Packaging Link: Linking pkg/kamailio/deb/trixie to the debian directory is a crucial step. Kamailio maintains native, distribution-specific build scripts within its repository. This link instructs dpkg-buildpackage to use the official rules designed specifically for Debian 13.
With our packages compiled and located inside /usr/src/kamailio/deb/, we can push them to our repository server (IP: <YOUR_REPO_IP>) for distribution.
From your build node, secure copy the packages directly to the repository upload directory:
Update the local package manager and install Kamailio alongside PostgreSQL and WebSocket modules:
Terminal window
apt-getupdate
# Install Kamailio and its essential modules
apt-getinstall-y\
sbc-kamailio\
sbc-kamailio-postgres-modules\
sbc-kamailio-presence-modules\
sbc-kamailio-websocket-modules
# Verify the installation and check the compiled version
kamailio-v
Example Output:
kamailio 6.1.4 (x86_64/linux)
[!NOTE]
What to do if a different version is returned?:
Newer Point/Patch Release (e.g., 6.1.4, 6.1.5): This is normal and expected when building from the stable maintenance branch 6.1, as it continuously incorporates verified bugfixes and patches.