Summary:ASTERISK-17013: [patch] SIP/TCP phones are not added to astdb - causes sip reload problems
Reporter:Matt Kemner (mkemner)Labels:
Date Opened:2010-11-24 05:46:17.000-0600Date Closed:2011-06-01 14:35:39
Versions:Frequency of
Environment:Attachments:( 0) siptcp-1.8.1.patch
Description:Phones that are registered via TCP are not added to the
/SIP/Registry database.  As a result, these phones "vanish" (become unregistered) after a sip reload and can not be called by asterisk until they re-register.


There's a comment in chan_sip.c that says "Saving TCP connections is useless, we won't be able to reconnect" - that might be the case when restarting
asterisk completely, but not on a sip reload.

Removing the socket.type check fixes this, and sip reloads do not
cause any problems for my TCP-connected phones now.
Comments:By: Harpreet (vois) 2010-12-16 17:10:37.000-0600

i read the notes made following changes in chan_sip.c.

Original code
if (!peer->rt_fromcontact && (peer->socket.type & SIP_TRANSPORT_UDP))

New code
if (!peer->rt_fromcontact && (SIP_TRANSPORT_UDP))

and i am running fine from last 1 hours. I have almost 600(400 TLS and 200 UDP) peers in this server. Did sip reload many times. If i find any bug i will update. Also i noticed big change in CPU consumption as compare to 1.6.2 and 1.8(with out this trick). Without this asterisk was almost @ 40-50% of CPU consumption and now asterisk is @ 10-20% of CPU usage.

By: Marcello Ceschia (marcelloceschia) 2011-01-18 11:12:45.000-0600

Its working, testet with 1.8.2

By: David Hajek (hajekd) 2011-01-20 11:24:06.000-0600

Works for me with

By: David Hajek (hajekd) 2011-02-15 02:35:10.000-0600

What is the status of this problem? Any plan to include this patch into main trunk?

By: Harpreet (vois) 2011-03-07 20:12:39.000-0600

I tested with 1.8.X(1,2,3), it works fine with patch.

By: Christoph (-kex-) 2011-03-16 04:29:19

I've tested with 1.8.3. With the patch, a sip reload doesn't kick all peers, but: When the Server gets restartet this occures:

ERROR[25526]: tcptls.c:375 ast_tcptls_client_start: Unable to connect SIP socket to IP:Port: Connection refused

As mentioned in the 'Additional Information' the Asterisk DB entires for the SIP peers are useless on a Asterisk restart.

By: Harpreet (vois) 2011-03-16 10:06:27

I also get same error some time. If i change peer for which i am getting the error to UDP it work fine but with TLS i will keep on getting same error.

ERROR[24923]: tcptls.c:375 ast_tcptls_client_start: Unable to connect SIP socket to ip:port: Connection refused
ERROR[24923]: tcptls.c:375 ast_tcptls_client_start: Unable to connect SIP socket to ip:port: Connection timed out

By: Brett Bryant (bbryant) 2011-06-01 14:35:38

r318918 | bbryant | 2011-05-13 13:58:53 -0400 (Fri, 13 May 2011) | 17 lines

Merged revisions 318917 via svnmerge from

 r318917 | bbryant | 2011-05-13 13:56:04 -0400 (Fri, 13 May 2011) | 11 lines
 This patch allows TCP peers into the ast_db where they were previously
 (closes issue ASTERISK-17472)
 Reported by: cmaj
       uploaded by cmaj (license 830)
 Tested by: cmaj