Home > World Of ICT > SIP over TCP using Asterisk IPPBX

SIP over TCP using Asterisk IPPBX


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  is easy brader🙂 , you just need to update sip_general_additional.conf  with the following config.

(Already tested on our production environtment)

;--------------------------------------------------------------------------------;
; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;
; this file must be done via the web gui. There are alternative files to make ;
; custom modifications, details at: http://freepbx.org/configuration_files ;
;--------------------------------------------------------------------------------;
;
vmexten=*97
disallow=all
allow=ulaw
allow=alaw
allow=h263
allow=h264
videosupport=yes
context=from-sip-external
callerid=Unknown
notifyringing=yes
notifyhold=yes
limitonpeers=yes
tos_sip=cs3
tos_audio=ef
tos_video=af41
alwaysauthreject=yes
; This part below you should add
tcpenable=yes
tcpbindaddr=0.0.0.0

Within your SIP clients definition you have to add transport=tcp for each individual connection, just like this;

;--------------------------------------------------------------------------------;
; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;
; this file must be done via the web gui. There are alternative files to make ;
; custom modifications, details at: http://freepbx.org/configuration_files ;
;--------------------------------------------------------------------------------;
;
[0507]
deny=0.0.0.0/0.0.0.0
type=friend
secret=wertekewerkewer
qualify=yes
port=5060
pickupgroup=
permit=0.0.0.0/0.0.0.0
nat=yes
; Add this line below
transport=tcp
mailbox=0507@device
host=dynamic
dtmfmode=rfc2833
dial=SIP/0507
context=from-internal
canreinvite=no
callgroup=
callerid=device <0507>
accountcode=
call-limit=50
[2907]
deny=0.0.0.0/0.0.0.0
type=friend
secret=wertekewerkewer
qualify=yes
port=5060
pickupgroup=
permit=0.0.0.0/0.0.0.0
nat=yes
mailbox=2907@device
host=dynamic
; Add this line below
transport=tcp
dtmfmode=rfc2833
dial=SIP/2907
context=from-internal
canreinvite=no
callgroup=
callerid=device <2907>
accountcode=
call-limit=50
[server1]
[Trunk1]
host=192.168.1.207
username=0507
secret=wertekewerkewer
type=peer

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

[asterik.localdomain ~]# asterisk -vvvr
Asterisk 1.6.0.26-FONCORE-r78, Copyright (C) 1999 - 2010 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
 == Parsing '/etc/asterisk/asterisk.conf': == Found
 == Parsing '/etc/asterisk/extconfig.conf': == Found
Connected to Asterisk 1.6.0.26-FONCORE-r78 currently running on asterisk(pid = 3990)
Verbosity is at least 3
asterisk*CLI> sip reload
asterisk*CLI> quit
Executing last minute cleanups
[asterisk.localdomain ~]# netstat -tlpn | grep 5060
tcp 0 0 0.0.0.0:5060 0.0.0.0:* LISTEN 3990/asterisk
[asterisk.localdomain ~]#

Just that simple bro…

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: