The subject is of interest to me as well.

Topology is Kamailio acting as an edge proxy to a farm of Asterisk boxes, proxy handles far-end NAT traversal, transport conversion from UDP/TCP/TLS on the WAN to UDP only on the LAN towards Asterisk. Keep-alive for endpoints on the Internet is achieved using Asterisk's quality OPTIONS messages.

The TCP error shows up rarely in the logs, at which time Asterisk's quality OPTIONS messages stop being delivered to the far endpoint, shortly after the peer goes OFFLINE. What's weird, say there's 60 IP desk phones under the same far NAT, only occasionally (1-3 times a day) some will experience the problem. 

What can be done to mitigate this problem? Tuning OS/Kamailio TCP settings, lower UAC register times?

Current TCP settings:
tcp_connection_lifetime=3605
tcp_send_timeout=3
tcp_connect_timeout=5
tcp_max_connections=4096

Thanks.

On Sat, Mar 17, 2018 at 5:45 AM, Kjeld Flarup <kjeld.flarup@liberalismen.dk> wrote:
We are developing an app with a pjsip client.

I see this error when trying to send an invite from kamailio.

Mar 17 00:29:46 raspberrypi /usr/sbin/kamailio[18720]: ERROR: <core> [tcp_main.c:4258]: tcpconn_main_timeout(): connect 62.44.134.85:43829 failed (timeout)

A few seconds before 62.44.134.85:43829 did a register.

I can understand that either the TCP connection was close by the other end or no one is listening.

How much can I see in a pcap from this scenario? I cannot see the invite, but somehow there must be some TCP communication to show what is failing.



--
-------------------- Med Liberalistiske Hilsner ----------------------
   Civilingeniør, Kjeld Flarup - Mit sind er mere åbent end min tegnebog
   Sofienlundvej 6B, 7560 Hjerm, Tlf: 40 29 41 49
   Den ikke akademiske hjemmeside for liberalismen - www.liberalismen.dk


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users