[OpenSIPS-Users] Presence over TCP with NAT, possible bug

Pete Kelly pkelly at gmail.com
Wed Feb 11 11:50:11 CET 2015


I have been experimenting recently with Presence over TCP and noticed
sometimes OpenSIPS fails to send a NOTIFY for a recent SUBSCRIBE, with a
tcp_send error in the logs.

I did some research and found an old issue which seems to be similar to
this as the inbound SUBSCRIBE TCP connection is on a high port, yet the
NOTIFY is to go to port 5060.

http://lists.opensips.org/pipermail/users/2013-May/025922.html

The fix here is to set tcp_accept_aliases =1

I tried this fix and it did not resolve the issue. Looking in the source
code it seems OpenSIPS may be trying to reuse an old/existing TCP
connection and is failing to find one - it does seem to be slightly
intermittent too. Sometimes (very rarely) it will work, and it seems to be
related to how many other TCP connections are open at the moment but I have
found it very very difficult to pin down. In the end I got round it by
looping the TCP SUBSCRIBE back to UDP and the OpenSIPS then produces a
NOTIFY/UDP no problem. This solution is a bodge and I would be interested
to know if the failure to tcp_send is a bug or something I can detect and
handle in the config somehow?

Using OpenSIPS 1.11 latest, in EXTRA_DEBUG mode this is the error that is
produced:

[19361]: ERROR:tm:msg_send: tcp_send failed
[19361]: ERROR:tm:t_uac: attempt to send to
'sip:111.111.8.146:5060;transport=tcp;lr'
failed

This is the inbound SUBSCRIBE and 200OK... I am simply dealing with this by
calling handle_subscribe('1');

T 2015/02/10 12:52:09.324134 111.111.8.146:28733 -> 192.168.0.113:5060 [AP]
SUBSCRIBE sip:user203 at test-domain.com SIP/2.0.
Via: SIP/2.0/TCP 111.111.8.146:5060
;egress-zone=DNS;branch=z9hG4bK5c628151ab895c5f2f45ed8bdafeda0d24504147.1569b0b8efc74f7daf3767cc97d0b38e;proxy-call-id=345dee99-7aca-44b4-bf5f-fb1f2e57774a;rport.
Via: SIP/2.0/TLS 10.15.20.113:54999
;branch=z9hG4bKfd5e7b1424014fc8de23205f0de3873e.1;received=188.39.51.2;rport=54999;ingress-zone=DefaultSubZone.
Call-ID: a1922a193e1b6057 at 10.15.20.113.
CSeq: 303 SUBSCRIBE.
Contact: <sip:pkelly at test-domain-2.com
;gr=urn:uuid:683f87a0-e026-5f0a-b86b-58139361c7a4>.
From: <sip:pkelly at test-domain-2.com>;tag=359dbb1cb104d434.
To: <sip:user203 at test-domain.com>.
Max-Forwards: 15.
Record-Route: <sip:111.111.8.146:5060;transport=tcp;lr>.
Record-Route: <sip:111.111.8.146:5061;transport=tls;lr>.
Record-Route: <sip:188.39.51.2:54999
;transport=tls;apparent=remove;ds;lr;proxy-call-id=345dee99-7aca-44b4-bf5f-fb1f2e57774a>.
User-Agent: Test.
Expires: 3600.
Event: presence.
Accept: application/pidf+xml.
P-Asserted-Identity: <sip:pkelly at test-domain-2.com>.
X-TAATag: 6ed63f01-3191-4a1f-b2a2-4121fb834f07.
Content-Length: 0.
.


T 2015/02/10 12:52:09.326218 192.168.0.113:5060 -> 111.111.8.146:28733 [AP]
SIP/2.0 200 OK.
Via: SIP/2.0/TCP 111.111.8.146:5060
;received=111.111.8.146;egress-zone=DNS;branch=z9hG4bK5c628151ab895c5f2f45ed8bdafeda0d24504147.1569b0b8efc74f7daf3767cc97d0b38e;proxy-call-id=345dee99-7aca-44b4-bf5f-fb1f2e57774a;rport=28733.
Via: SIP/2.0/TLS 10.15.20.113:54999
;branch=z9hG4bKfd5e7b1424014fc8de23205f0de3873e.1;received=188.39.51.2;rport=54999;ingress-zone=DefaultSubZone.
Call-ID: a1922a193e1b6057 at 10.15.20.113.
CSeq: 303 SUBSCRIBE.
From: <sip:pkelly at test-domain-2.com>;tag=359dbb1cb104d434.
To: <sip:user203 at test-domain.com>;tag=e3eb1f19b04f8e78afd28f643f416b5f-9be8.
Record-Route: <sip:111.111.8.146:5060;transport=tcp;lr>.
Record-Route: <sip:111.111.8.146:5061;transport=tls;lr>.
Record-Route: <sip:188.39.51.2:54999
;transport=tls;apparent=remove;ds;lr;proxy-call-id=345dee99-7aca-44b4-bf5f-fb1f2e57774a>.
Expires: 3600.
Contact: <sip:sa at 222.222.200.79:5060;transport=tcp>.
Server: Test.
Content-Length: 0.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20150211/7ede52ca/attachment-0001.htm>


More information about the Users mailing list