OpenSIPS Install Guide: Configuration, Customization & Why It Beats Kamailio

  • Home
  • opensips
  • OpenSIPS Install Guide: Configuration, Customization & Why It Beats Kamailio
OpenSIPS Install Guide

Are you looking for a SIP server that you can depend on for your VoIP, WebRTC, or real-time communications projects that is efficient, flexible, and scalable? If so, you have come to the right place. Whether it is about the integration with Asterisk, FreeSWITCH, or Docker, or to decide between OpenSIPS or Kamailio, this article will cover all aspects from installation, configuration, and comparison.

Why Choose OpenSIPS?

OpenSIPS is an open-source SIP server that provides tremendous call routing, load balancing, and real-time session control capabilities. It is recognized for its flexibility, rich module support, and level of ease in scripting, so it’s a great solution for:

  • VoIP service providers
  • SIP trunking and IP telephony solutions
  • WebRTC applications

Scalable SIP infrastructure for carriers and startups

OpenSIPS vs. Kamailio: Which One Is Right for You?

Both OpenSIPS and Kamailio originate from the SIP Express Router (SER) project, but over the years, they’ve taken different paths.

FeatureOpenSIPSKamailio
FocusFlexibility & ScriptingHigh-Performance SIP Routing
Config StyleHuman-friendly scriptingC-like syntax (steeper learning)
ModulesRich built-in module supportMore manual setup needed
Best ForCustom routing, VoIP appsHigh-speed SIP handling
Learning CurveModerateMore complex

Advantages of OpenSIPS:

  • Easy to customize routing logic (e.g., Least-Cost Routing)
  • Friendly configuration files
  • Strong WebRTC support

Works seamlessly with Asterisk, FreeSWITCH, and Docker

Limitations of OpenSIPS:

  • Slightly lower raw performance than Kamailio under extreme loads
  • Needs tuning for very high-load environments

How to Install OpenSIPS on Debian/Ubuntu

On Debian:

Follow the steps below to install OpenSIPS along with the MySQL module on a Debian 12 system:

bash

# Update system & install dependencies
sudo apt update
sudo apt install -y gnupg2 wget curl

# Add OpenSIPS repo key using gpg
wget -qO - https://apt.opensips.org/opensips-org.gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/opensips-org.gpg > /dev/null

# Add OpenSIPS APT repository
echo "deb https://apt.opensips.org/bookworm 3.4-releases" | sudo tee /etc/apt/sources.list.d/opensips.list

# Update and install OpenSIPS with MySQL module
sudo apt update
sudo apt install -y opensips opensips-mysql-module

On Ubuntu:

bash

# Update and install dependencies
sudo apt update
sudo apt install -y wget gnupg2

# Add OpenSIPS repo
wget -O- https://apt.opensips.org/opensips-org.gpg | sudo apt-key add -
echo "deb https://apt.opensips.org/jammy 3.4-releases" | sudo tee /etc/apt/sources.list.d/opensips.list

# Install OpenSIPS with HTTP support
sudo apt update
sudo apt install opensips opensips-http-modules

Running OpenSIPS in Docker

Prefer containers? Here's how to run OpenSIPS in Docker:

bash

docker run -d --name opensips -p 5060:5060/udp opensips/opensips:3.4

Basic OpenSIPS Configuration

The heart of OpenSIPS lies in the /etc/opensips/opensips.cfg file. Here’s a minimal config to handle SIP registrations and routing:

listen=udp:0.0.0.0:5060  # Listen on default SIP port

loadmodule "usrloc.so"
loadmodule "registrar.so"

route[REGISTER] {
    if (!save("location")) {
        sl_reply_error();
        exit;
    }
}

route {
    if (!lookup("location")) {
        sl_send_reply("404", "User Not Found");
        exit;
    }
    t_relay();
}

Customizing OpenSIPS: Going Beyond Basics

Extend OpenSIPS using powerful modules:

  • MySQL/PostgreSQL – User authentication, registrations
  • MRTPProxy – Essential for WebRTC media handling
  • HTTP/JSON – For REST API integration

Example: Enabling WebRTC Support


loadmodule "rtpproxy.so"
loadmodule "websocket.so"

modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:22222")
modparam("websocket", "ws_port", 5066)

Integrating OpenSIPS with Asterisk & FreeSWITCH

OpenSIPS + Asterisk

OpenSIPS can act as a SIP proxy, improving Asterisk’s scalability and security.

route {
    if (uri=~"sip:.*@asterisk") {
        rewritehost("asterisk-ip");
        t_relay();
    }
}

OpenSIPS + FreeSWITCH

If you're handling WebRTC, media mixing, or conferencing, FreeSWITCH is the perfect media server to pair with OpenSIPS.

route {
    if (uri=~"sip:.*@freeswitch") {
        rewritehost("freeswitch-ip");
        t_relay();
    }
}

Final Thoughts: Is OpenSIPS Right for You?

At Sheerbit, we’ve helped clients around the world deploy custom OpenSIPS solutions and here’s what we’ve learned:

Choose OpenSIPS if you want:

✅ Easy-to-read config files

✅ Custom call routing logic (LCR, ENUM, failover)

✅ Seamless WebRTC integration

✅ A flexible solution that integrates with Asterisk, FreeSWITCH, and Docker

Consider Kamailio if:

  • You need ultra-high-performance SIP handling
  • You’re comfortable with complex config files

Next Steps for You

  • Install OpenSIPS on your preferred OS (Debian/Ubuntu)
  • Experiment with routing and registration configs
  • Try WebRTC integration using RTPProxy
  • Compare results with Kamailio if you’re evaluating options

Are you looking to build a powerful and scalable VoIP or SIP-based communications platform? Sheerbit provides experienced OpenSIPS development services tailored to your business needs.

Whether you’re building a SIP proxy, load balancer, or real-time communications server, at Sheerbit our expert OpenSIPS developers deliver solutions that are robust, secure, and highly performant. From system architecture and design to deployment and maintenance support, we do it all. 

Let Sheerbit’s proven experience in OpenSIPS empower your communications infrastructure. Are you ready to scale your communications ecosystems? 

Contact Sheerbit today to hire an experienced OpenSIPS developer to help you take your real-time communications to the next level!

Leave A Comment