In this article we extend the Kamailio IMS platform (as described here) with the NAT traversal capabilities with the help of the PCSCF and RTPproxy server. The RTPproxy will be installed on the same machine as the PCSCF is running. From the performance point of view you may install rtpproxy on any machine which is reachable over IP.
Installing RTPproxy server
Install rtpproxy on the PCSCF server
apt-get install rtpproxy
open the /etc/default/rtpproxy file and check if there is line
CONTROL_SOCK=udp:127.0.0.1:22222
which will be used for communication between PCSCF and RTPproxy server.
Try if it works and if not should change to to
CONTROL_SOCK="udp:localhost:22222"
There have to be "localhost" keyword, no 127.0.0.1.
Now add a new line with
LISTEN_ADDR=158.193.139.40 EXTRA_OPTS="-l ${LISTEN_ADDR}"
where we need to specify the IP addresses on which the rtpproxy will listen (LISTEN_ADDR), and "-l" options switch which allow to correctly start the rtpproxy server.
Without this the RTPproxy server is returning message
Starting RTP relay: rtpproxy: explicit binding address has to be specified in UDP command mode
and did not start it. So finally we have start them correctly with
/etc/init.d/rtpproxy start Starting RTP relay: rtpproxy.
Configuration of the PCSCF (Kamailio based)
Our PCSCF server is Kamailio based. The configuration of Kamailio with RTPproxy as the solution of NAT traversal problem we already have described on special article: Configuring NAT traversal using Kamailio 3.1 and the Rtpproxy server, but there are only a few of information comparable, caused the module documentation of Kamailio IMS components is not available.
Open /etc/kamailio/kamailio.cfg file and look through if there is
#!define WITH_NAT
directive. By default it is included inside of the default configuration file of the PCSCF.
Then check if control socket for communication with RTPproxy is specified:
#!ifdef WITH_NAT #!define RTPPROXY "udp:127.0.0.1:22222" #!endif
and compare it to your rtprpoxy configuration and modify if required (if there is problem with connection shuld put there instead of IP address word localhost, so the definition block look like)
#!ifdef WITH_NAT
#!define RTPPROXY "udp:localhost:22222"
#!endif
That's all.
In our topology it start working!
Testing
Solution works well in both cases (ip address vs localhost) for Monster IMS client.
For Boghe IMC client the NAT solution does not work.