This guide describes Kamailio 3.2 configuration with RTP Proxy.
Requirements:
-
Kamailio 3.2 (clean install wtih mysql for auth and usrloc in my case)
-
follow guide http://nil.uniza.sk/sip/kamailio/adding-mysql-support-kamailio-31-debian-lenny
- this guide is for Kamailio 3.1, but mysql configuration is the same for Kamailio 3.2
-
follow guide http://nil.uniza.sk/sip/kamailio/adding-mysql-support-kamailio-31-debian-lenny
-
RTP Proxy
-
#apt-get install rtpproxy #/etc/init.d/rtpproxy stop
-
Configuration is very easy, because Kamailio 3.2 adds preconfigured parameters and routing logic (all handled within #!ifdef .. #!endif blocks).
We need to add
#!define WITH_NAT
to the defined values section.
Then, in the Route[Registrar] we need to uncomment line "setflag(FLB_NATSIPPING)":
# uncomment next line to do SIP NAT pinging setbflag(FLB_NATSIPPING);
Setting this flag when REGISTER message arrives will cause Kamailio to send keepalives to the user. This is done using sip OPTION request. Client's response (i.e. 200 OK) to this request refreshes the NAT translation.
We can also modify the sipping_from parameter of the nathelper module to match out domain:
modparam("nathelper", "sipping_from", "sip:pinger@p3b.sip.uniza.sk")
New design of the kamailio.cfg file provides the default routing logic for RTPproxy support. Route[NAT] and Route[RTPPROXY] have been replaced by Route[NATDETECT] and Route[NATMANAGE]. These new routing logic blocks utilize functions provided by the new RTPPROXY module (see http://www.kamailio.org/docs/modules/3.2.x/modules/rtpproxy.html for documentation).
All that remains is to run RTPproxy and Kamailio 3.2.
Start RTPproxy by typing following command:
$rtpproxy -l <your_public_IP> -s udp:localhost:7722
*note: you can not run RTPproxy as superuser, switch to non-privileged user before starting RTPproxy server
Start Kamailio 3.2 by:
/etc/init.d/kamailio start
If all went well, users behind NAT can now communicate with each other. Kamailio will detect whether they are behind NAT and if they are, their RTP streams will traverse RTPproxy.