[SR-Users] Kamailio RtpProxy MHomed

Pascal Fautré pascal.fautre at alt-tab.be
Wed Jul 16 15:08:58 CEST 2014


Hi,

I tried to use Kamailio / RTPProxy in mhomed setup without any luck.
I had no problem to configure it with only 1 interface, without mhomed, everything worked perfectly.

The RTP streams where not established correctly even if I managed to have to proper IP in the SIP INVITE (C & O).

Versions:
version: kamailio 4.1.4 (x86_64/linux) 
flags: STATS: Off, USE_TCP, USE_TLS, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, DBG_QM_MALLOC, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 4MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown 
compiled on 04:23:19 Jun 13 2014 with gcc 4.7.2

RTPProxy -v:
Basic version: 20040107
Extension 20050322: Support for multiple RTP streams and MOH
Extension 20060704: Support for extra parameter in the V command
Extension 20071116: Support for RTP re-packetization
Extension 20071218: Support for forking (copying) RTP stream
Extension 20080403: Support for RTP statistics querying
Extension 20081102: Support for setting codecs in the update/lookup command
Extension 20081224: Support for session timeout notifications


Here is my RTPProxy config (/etc/default/rtpproxy) :
CONTROL_SOCK=udp:127.0.0.1:7722
EXTRA_OPTS=“-l PU.BL.IC.IP/PRI.VA.TE.IP -m 11000 -M 12000 -d DBUG:LOG_LOCAL3


Here are snippets of my kamailio.cfg:

port=5060
mhomed=1

# RTPProxy control
route[NATMANAGE] {
#!ifdef WITH_NAT
        if (is_request()) {
                if(has_totag()) {
                        if(check_route_param("nat=yes")) {
                                setbflag(FLB_NATB);
                        }
                }
        }
        if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))
                return;

        xlog("NATMANAGE M=$rm OU=$ou  RURI=$ru RD=$rd F=$fu T=$tu NH=$nh(d) IP=$si ID=$ci\n");

        if(dst_ip == PUBLIC_IP) {
                if(is_ipv4($nh(d)) && is_in_subnet($nh(d), PRIVATE_NET)) {
                        xlog("NATMANAGE coei\n");
                        rtpproxy_manage("coei", PRIVATE_IP);
                } else {
                        xlog("NATMANAGE coee\n");
                        rtpproxy_manage("coee", PUBLIC_IP);
                }
        } else {
                if(is_ipv4($nh(d)) && is_in_subnet($nh(d), PRIVATE_NET)) {
                        xlog("NATMANAGE coii\n");
                        rtpproxy_manage("coii", PRIVATE_IP);
                } else {
                        xlog("NATMANAGE coie\n");
                        rtpproxy_manage("coie", PUBLIC_IP);
                }
        }

        if (is_request()) {
                if (!has_totag()) {
                        if(t_is_branch_route()) {
                                add_rr_param(";nat=yes");
                        }
                }
        }
        if (is_reply()) {
                if(isbflagset(FLB_NATB)) {
                        if(is_first_hop())
                                set_contact_alias();
                }
        }
#!endif
        return;
}


Calls were correctly going to the desired rtpproxy_manage options. 
Now I’m not quite sure I’m using the correct ones.
I had to specify the PUBLIC_IP or PRIVATE_IP in the rtpproxy_manage calls in order to have the correct IP address in the C and O headers of the SIP INVITE. Without that, the public IP would be sent as C and O params to phones on the private subnet.
In fact not a single call direction would give correct RTP streams.

Any idea where I missed the turn?


Cheers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140716/2b304352/attachment.html>


More information about the sr-users mailing list