Kamailio Examples
Working kamailio.cfg files and KEMI Lua scripts for the many roles a Kamailio
server can take: registrar, proxy, load balancer, session border controller, WebRTC gateway
and capture node. Every example is self contained and can be read on its own.
Examples target Kamailio v5.x. Older wiki-sourced configurations have been updated, but module parameters still vary between minor releases, so check them against the module documentation for the version you run.
Core SIP features
Message handling, registration, transactions, dialogs and routing basics.
Routing and proxying
Distributing and steering traffic between endpoints, domains and carriers.
NAT and media
Traversing NAT and relaying RTP through RTPProxy or RTPEngine.
WebRTC
Browsers talking to browsers and to the PSTN over WSS and DTLS-SRTP.
Lua and KEMI scripting
Moving the routing logic out of kamailio.cfg and into Lua.
Call handling and accounting
Forking, early media, CDRs and voice quality measurement.
Databases
Persisting subscribers, location and state.
Security, tracing and control
TLS, packet capture and remote control interfaces.
Testing
Driving the configurations with synthetic traffic.
Operational notes
Reference material that applies across the examples.
Running an example
Each directory holds the configuration plus, where relevant, dispatcher lists, database seed files, Lua modules and SIPp scenarios. To try one out:
git clone https://github.com/altanai/kamailioexamples.git
cd kamailioexamples/<example>
# sanity check the configuration before loading it
kamailio -c -f kamailio.cfg
# run it in the foreground with debug output
kamailio -f kamailio.cfg -DD -E
Adjust listen, alias, mpath and any database URLs to match your host before starting the
server. The kamctl, kamcmd and sipsak
notes cover inspecting a running instance.