SIP OpenSIPS Examples Configuration files for the roles OpenSIPS can play

OpenSIPS Examples

Working opensips.cfg files for the roles an OpenSIPS server can take: registrar, stateless and stateful proxy, load balancer, session border controller and media relay. Each example is self contained and can be read on its own.

OpenSIPS is a “multi-functional, multi-purpose signaling SIP server used by carriers, telecoms or ITSPs”. Its routing logic is split across route blocks that fire at different points in a transaction, so most of these examples are organised around which block does the work.

Getting started

The smallest configurations that still answer SIP traffic.

Route types

OpenSIPS splits its logic across route blocks that fire at different points in a transaction.

Registration and users

Location storage and per-user services.

Proxying and scaling

Distributing traffic and sitting at the border of the network.

Media

Relaying RTP between endpoints.

Security and traffic control

Deciding who may call, how often, and spotting abuse.

Data stores

Caching and persisting state outside the process.

Notes

Reference material that applies across the examples.

The route blocks

Block Fires when
route A SIP request arrives and needs a routing decision.
branch_route Each outgoing branch leaves, from inside t_relay().
failure_route A negative final reply comes back and the transaction can be retried.
onreply_route A reply passes through on its way to the caller.
local_route OpenSIPS itself generates a request rather than relaying one.
error_route A parsing or script error occurs.
startup_route The server starts, before any traffic is accepted.
timer_route A configured interval elapses.
event_route A module raises an event.

Running an example

git clone https://github.com/altanai/opensipsexamples.git
cd opensipsexamples/<example>

# check the configuration; returns 0 when it is valid
opensips -C opensips.cfg

# run in the foreground with logging to stderr
opensips -f opensips.cfg -E -D

Set listen, mpath and any database URLs to match your host first. Module and core versions must agree, otherwise OpenSIPS refuses to load the module with a version_control error — see the installation notes. Every change to the configuration needs a restart.