[OpenSIPS-Users] Opensips 1.8 with rtpproxy NAT error

Varga Zsolti vargazsolti at gmail.com
Fri Jul 27 14:11:55 CEST 2012


Hi,

I'm in trouble with nat detect.
The configuration:
Opensips 1.8 - rtpproxy 1.2.1-1

At startup everything is ok:

Log snipet RTP proxy:
...
Jul 27 13:42:00 opensips rtpproxy[6812]: DBUG:handle_command: received
command "8408_0 V"
Jul 27 13:42:00 opensips rtpproxy[6812]: DBUG:doreply: sending reply
"8408_0 20040107#012"
Jul 27 13:42:00 opensips rtpproxy[6812]: DBUG:handle_command: received
command "8408_1 VF 20050322"
Jul 27 13:42:00 opensips rtpproxy[6812]: DBUG:doreply: sending reply
"8408_1 1#012"
Jul 27 13:42:00 opensips /usr/sbin/opensips[8408]:
INFO:rtpproxy:rtpp_test: rtp proxy <udp:127.0.0.1:12221> found, support
for it enabled
Jul 27 13:42:00 opensips rtpproxy[6812]: DBUG:handle_command: received
command "8408_2 VF 20071116"
....

Users are connected:

 AOR:: xxxxxxx
                Contact:: sip:xxxxxxx at 188.xx.xx.xx:1036 Q=
                        Expires:: 3197
                        Callid:: cade1bd3-35b41747 at 10.64.42.60
                        Cseq:: 12909
                        User-agent:: Cisco/SPA303-7.4.8a
                        Received:: sip:188.xx.xx.xx:1030
                        State:: CS_SYNC
                        Flags:: 0
                        Cflag:: 1024
                        Socket:: udp:xx.xx.xx.xx:5060
                        Methods:: 5247

As i see somehow i got the private address in callid:
cade1bd3-35b41747 at 10.64.42.60 .

I have also a 3cx client on Android phone. The strange is if i register
without build in nathelper from 3CX the user record is shown as nated:

Contact:: sip:xxxxxx at 10.10.10.2:51255;ob Q=
                        Expires:: 53
                        Callid:: YdSlIOe01sZg-6oNyZfpEsS4tR5NNif5
                        Cseq:: 9860
                        User-agent:: 3CXPhone for Android 2.0.5
                        Received:: sip:xx.xx.xx.xx:51255
                        State:: CS_SYNC
                        Flags:: 0
                        Cflag:: 1024
                        Socket:: udp:xx.xx.xx.xx:5060
                        Methods:: 8047

If nathelper is enabled on 3cx the user is not nated:

Contact:: sip:xxxxxx at 91.xx.xx.xx:54896;transport=UDP;ob Q=
                        Expires:: 119
                        Callid:: DrQpY1qQArrYfGICemiz-zVQlt.QfiQ9
                        Cseq:: 51989
                        User-agent:: 3CXPhone for Android 2.0.5
                        State:: CS_NEW
                        Flags:: 0
                        Cflag:: 0
                        Socket:: udp:xx.xx.xx.xx:5060
                        Methods:: 8047

I didn't understand why opensips not detect NAT. Some code from conf:

.....
force_rport();
        xlog("L_INFO","Via: $hdr(Via)\n");
        xlog("L_INFO","Max-Forwards: $hdr(Max-Forwards)\n");
        xlog("L_INFO","To: $hdr(To)\n");
        xlog("L_INFO","From: $hdr(From)\n");
        xlog("L_INFO","User-Agent: $hdr(User-Agent)\n");
        xlog("L_INFO","Call-ID: $hdr(Call-ID)\n");
        xlog("L_INFO","CSeq: $hdr(CSeq)\n");
        xlog("L_INFO","Contact: $hdr(Contact)\n");
        xlog("L_INFO","Content-Type: $hdr(Content-Type])\n");
        xlog("L_INFO","Content-Length: $hdr(Content-Length)\n");
        if (nat_uac_test("2")) {
                if (is_method("REGISTER")) {
                         xlog("L_INFO", "$ci|log|address in Via differs
from source IP");

                        fix_nated_register();
                        setbflag(3);

        } else  if (is_method("INVITE")) {
                        fix_nated_contact();
                        fix_nated_sdp("1");
                        setflag(3);
                }
        }
........


 if (has_totag()) {
    if (check_route_param("nat=yes"))
                                setflag(3);

........

route[1] {
        # for INVITEs enable some additional helper routes
        if (is_method("INVITE")) {

                if (isflagset(3)) {
                        rtpproxy_offer("ro");
                }

                t_on_branch("2");
                t_on_reply("2");
                t_on_failure("1");
        }
        if (isflagset(3)) {
                add_rr_param(";nat=yes");
                }

.....

onreply_route[2] {
        if (nat_uac_test("2"))
                fix_nated_contact();
        if ( isflagset(10) )
                rtpproxy_answer("ro");
        xlog("incoming reply\n");
}


The call scenario: If i have 2 client with nat detected the call is ok,
i have sound, and i can capture rdp with wireshark, but if i try to call
any client without nat (but the internal ip is in Call-ID) the call was
dropped.

I didn't know what is the problem.

Can someone please help me to find out what is happening here ?

Thanks,
Zsolt






More information about the Users mailing list