using SIP over TCP with asterisk

September 20, 2014

SIP commonly runs over UDP but there are times when you may need to run it over TCP.

To allow SIP TCP clients to connect with asterisk update sip.conf with the following

[general]
tcpenable=yes
tcpbindaddr=0.0.0.0

Within your SIP clients definition you have to add transport=tcp for each individual connection.

[client001]
callerid="Client 001" <001>
username=client001
secret=password
type=friend
host=dynamic
context=internal
canreinvite=yes
mailbox=001@default
transport=tcp
disallow=all
allow=alaw
nat=route
dtmfmode=inband

Reload sip within the asterisk console and confirm that asterisk is now listening on 5060/tcp with netstat.

server*CLI> sip reload
server*CLI> quit
Executing last minute cleanups
$ sudo netstat  -tlpn | grep 5060
tcp        0      0 0.0.0.0:5060            0.0.0.0:*               LISTEN      17414/asterisk  

About Rene Cunningham

An expert in the Linux Infrastructure space, Rene is a passionate Systems Engineer with a strong background in Open Source Software Stacks and large scale infrastructure. Based in Melbourne, Australia, Rene works on a highly experienced, distributed team of professional System Administrators at The Linux Foundation.