[OpenSIPS-Users] UDP to TCP issue with Re-INVITE

Mickael Hubert mickael at winlux.fr
Tue Dec 17 05:09:05 EST 2019


Sure !
You can find it here  (it's jinja2 template, but it readable ;) ) :
https://github.com/Mickaelh51/opensips-tcp-issue/blob/master/micka_opensips_conf.txt
There is only the routing process in this file. Feel free to ask me if you
want other parts of my conf.

++

Le lun. 16 déc. 2019 à 21:04, David Villasmil <
david.villasmil.work at gmail.com> a écrit :

> Can we see your cfg ?
>
> On Mon, 16 Dec 2019 at 16:44, Mickael Hubert <mickael at winlux.fr> wrote:
>
>> Thanks for your help David,
>> I'm already in debug level:
>> log_level=4
>>
>> UAC is not in location table, because it's IP2IP connection (without
>> registration)
>>
>> I did another test:
>> I try to activate "Pp" in dialog creation to send OPTIONS to both sides
>> (leg A and B)
>> SIP client (tcp:192.168.10.203) -- my NAT router --> (tcp:2.2.2.2:8060)
>> opensips (udp:10.1.15.126:5060) --> rest of infra (udp:10.1.15.0/24:5060)
>>
>> OPTIONS from private interface is sent, but OPTIONS from public interface
>> can't be sent to natted UAC:
>>
>> Dec 16 16:52:22 am-frontal1a-test /usr/local/sbin/opensips[2705]:
>> ERROR:tm:msg_send: send() to 192.168.10.203:5060 for proto tcp/2 failed
>> Dec 16 16:52:22 am-frontal1a-test /usr/local/sbin/opensips[2705]:
>> ERROR:tm:t_uac: attempt to send to
>> 'sip:192.168.10.203;transport=tcp;r2=on;lr;did=d9.ed83b676' failed
>> Dec 16 16:52:43 am-frontal1a-test /usr/local/sbin/opensips[2693]:
>> ERROR:tm:msg_send: send() to 192.168.10.203:5060 for proto tcp/2 failed
>> Dec 16 16:52:43 am-frontal1a-test /usr/local/sbin/opensips[2693]:
>> ERROR:tm:t_uac: attempt to send to
>> 'sip:192.168.10.203;transport=tcp;r2=on;lr;did=d9.ed83b676' failed
>>
>> My other test (into VPN) works like a charm, but UAC is registered !
>>
>> Is there a way to keep natted source ip and port to reuse them with
>> initial request from UAS ?
>> I use topology_hiding function, and it's not compatible with
>> record_route. But I tested to deactive TH and active RR, it's exactly the
>> same issue, the Re-INVITE from UAS is not forwarded to UAC.
>>
>> thanks
>>
>> Le lun. 16 déc. 2019 à 15:52, David Villasmil <
>> david.villasmil.work at gmail.com> a écrit :
>>
>>> please increase the debug level and paste the log. Also, check what is
>>> saved as the location for the user.
>>>
>>> On Mon, 16 Dec 2019 at 14:48, Mickael Hubert <mickael at winlux.fr> wrote:
>>>
>>>> Maybe I founded:
>>>> I tested a call through Internet connection and I can see (uac natted):
>>>>
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:proto_tcp_send: *no open tcp connection found*, opening new
>>>> one, async = 1
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:probe_max_sock_buff: getsockopt: snd is initially 16384
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> INFO:core:probe_max_sock_buff: using snd buffer of 416 kb
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> INFO:core:init_sock_keepalive: TCP keepalive enabled on socket 11
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:tcpconn_async_connect: Polling is overdue
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:tcpconn_async_connect: Create connection for async connect
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:print_ip: tcpconn_new: new tcp connection to: 192.168.10.203
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:tcpconn_new: on port 5060, proto 2
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:proto_tcp_send: Successfully connected from interface
>>>> 192.168.10.203:5060 to 192.168.10.203:56899!
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:proto_tcp_send: Successfully started async connection
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:tm:insert_timer_unsafe: [0]: 0x7efe91196790 (99)
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:tm:t_relay_to: new transaction fwd'ed
>>>> Dec 16 15:15:44 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> retcode = 1
>>>>
>>>> The re-invite is never forwarded (no trace with sngrep, or classic
>>>> tcpdump)
>>>> I don't know why opensips wants use private IP and not natted IP...
>>>> So...
>>>>
>>>> I tested through VPN connection (uac natted):
>>>>
>>>> Dec 16 15:37:28 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:tcp_conn_get: *tcp connection found* (0x7efe9118cf48),
>>>> acquiring fd
>>>> Dec 16 15:37:28 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:tcp_conn_get: c= 0x7efe9118cf48, n=16, Usock=168
>>>> Dec 16 15:37:28 am-frontal1a-test /usr/local/sbin/opensips[31187]:
>>>> DBG:core:handle_worker: read response= 7efe9118cf48, 1, fd -1 from 35
>>>> (31165)
>>>> Dec 16 15:37:28 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:tcp_conn_get: after receive_fd: c= 0x7efe9118cf48 n=8 fd=11
>>>> Dec 16 15:37:28 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:proto_tcp_send: sending via fd 11...
>>>> Dec 16 15:37:28 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:async_tsend_stream: Async successful write from first try on
>>>> 0x7efe9118cf48
>>>> Dec 16 15:37:28 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:core:proto_tcp_send: after write: c= 0x7efe9118cf48 n/len=1014/1014
>>>> fd=11
>>>> Dec 16 15:37:28 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:tm:insert_timer_unsafe: [0]: 0x7efe91196790 (1403)
>>>> Dec 16 15:37:28 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> DBG:tm:t_relay_to: new transaction fwd'ed
>>>> Dec 16 15:37:28 am-frontal1a-test /usr/local/sbin/opensips[31165]:
>>>> retcode = 1
>>>>
>>>> The re-inivte is forwarded correctly !
>>>>
>>>> I pretty sure I use the keepalived mecasim ....
>>>>
>>>>
>>>> Le lun. 16 déc. 2019 à 14:27, Mickael Hubert <mickael at winlux.fr> a
>>>> écrit :
>>>>
>>>>> Hi David,
>>>>> Yes I use it
>>>>>
>>>>> if (nat_uac_test("3") && ($Ri == $var(publicip) || $Ri == $var(vpnip)
>>>>> ))
>>>>> {
>>>>> xlog("L_INFO","$avp(startlog) -- Nated EP Detected\n");
>>>>> if (force_rport())
>>>>> {
>>>>> xlog("L_INFO","$avp(startlog) -- RPORT parameter forced\n");
>>>>> }
>>>>> if (fix_nated_contact())
>>>>> {
>>>>> xlog("L_INFO","$avp(startlog) -- Nated $rm's Contact Fixed !\n");
>>>>> }
>>>>> if (fix_nated_sdp("10"))
>>>>> {
>>>>> xlog("L_INFO","$avp(startlog) -- Nated SDP Fixed for $rm\n");
>>>>> }
>>>>> }
>>>>>
>>>>> Le lun. 16 déc. 2019 à 13:50, David Villasmil <
>>>>> david.villasmil.work at gmail.com> a écrit :
>>>>>
>>>>>> Aré you using nathelper?
>>>>>>
>>>>>> On Mon, 16 Dec 2019 at 12:06, Mickael Hubert <mickael at winlux.fr>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>> I advanced in my LAB
>>>>>>> I have this configuration:
>>>>>>> SIP client (tcp:192.168.10.203) -- my NAT router --> (tcp:
>>>>>>> 2.2.2.2:8060) opensips (udp:10.1.15.126:5060) --> rest of infra
>>>>>>> (udp:10.1.15.0/24:5060)
>>>>>>>
>>>>>>> When I received the reinvite from "rest of infra" on private
>>>>>>> interface (10.1.15.126), I could see this log:
>>>>>>>
>>>>>>> Dec 16 12:55:27 am-frontal1a-test /usr/local/sbin/opensips[26160]:
>>>>>>> ERROR:tm:msg_send: send() to 192.168.10.203:5060 for proto tcp/2
>>>>>>> failed
>>>>>>> Dec 16 12:55:27 am-frontal1a-test /usr/local/sbin/opensips[26160]:
>>>>>>> ERROR:tm:t_forward_nonack: sending request failed
>>>>>>> Dec 16 12:55:27 am-frontal1a-test /usr/local/sbin/opensips[26160]:
>>>>>>> retcode = -6
>>>>>>>
>>>>>>> I don't know why OpenSIPS tries to send the Re-invite to client
>>>>>>> private IP instead client public port and IP (natted).
>>>>>>>
>>>>>>> Do you have an idea please ?
>>>>>>>
>>>>>>> thanks
>>>>>>>
>>>>>>> Le jeu. 12 déc. 2019 à 11:09, Mickael Hubert <mickael at winlux.fr> a
>>>>>>> écrit :
>>>>>>>
>>>>>>>> Hi all,
>>>>>>>> I have an issue, opensips doesn't want forward Re-INVITE during UDP
>>>>>>>> to TCP mapping session.
>>>>>>>> Customer (NATTED) -- TCP --> (public interface listen tcp:8060)
>>>>>>>> OpenSIPS (private interface listen udp:5060) --> rest of infrastructure
>>>>>>>> (udp:5060)
>>>>>>>>
>>>>>>>> I can send a call from customer to OpenSIPS (initial INVITE, 200OK,
>>>>>>>> etc ...).
>>>>>>>> But when I received Re-INVITE from UAS (sip session timer),
>>>>>>>> OpenSIPS doesn't forward it to customer.
>>>>>>>>
>>>>>>>> You can see the call flow here:
>>>>>>>> https://photos.app.goo.gl/eUSb5MvBhUfueaoM7
>>>>>>>> You can see SIP messages and opensips's logs in txt file in
>>>>>>>> attachment
>>>>>>>>
>>>>>>>> OpenSIPS handles on it's public interface:
>>>>>>>> - Topology hiding
>>>>>>>> - Nat detection
>>>>>>>>
>>>>>>>> Thanks a lot for you help !
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>> Users mailing list
>>>>>>> Users at lists.opensips.org
>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>
>>>>>> --
>>>>>> Regards,
>>>>>>
>>>>>> David Villasmil
>>>>>> email: david.villasmil.work at gmail.com
>>>>>> phone: +34669448337
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users at lists.opensips.org
>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>
>>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org
>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>> --
>>> Regards,
>>>
>>> David Villasmil
>>> email: david.villasmil.work at gmail.com
>>> phone: +34669448337
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
> --
> Regards,
>
> David Villasmil
> email: david.villasmil.work at gmail.com
> phone: +34669448337
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20191217/a3732419/attachment-0001.html>


More information about the Users mailing list