SIP TCP support in Asterisk


Edit: This post is now quite out of date. There’s a more recent discussion of this at the trixbox forums.

Original Post:
Despite digium‘s screwed up licensing restrictions, and its diabolical coding standards (something which Callweaver will hopefully make a thing of the past, but that’s for another day), SIP over TCP support is now finally available in asterisk (at least for the 1.2 branch).

Brief instructions how to upgrade your 1.2.x installation are given below:

Download the source

cd /usr/src
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz
tar -zxf asterisk-1.2.24.tar.gz

Get and apply the patch

cd asterisk-1.2.24/channels
wget -O asterisk-1.2.24-tcp-patch "http://bugs.digium.com/file_download.php?file_id=15742&type=bug&download"
patch < asterisk-1.2.24-tcp-patch

ensure at this point that all of patch was applied correctly. If it wasn't, probably best to check the related bug report on digium for details. Next we build & install it

cd ..
make
asterisk -rx "stop gracefully"
make install
asterisk -vvvc

If everything works as it should, your asterisk should be up and running again, but this time with SIP over TCP support. You can check what ports/protocols asterisk is listening on using the command

netstat -l -p | grep asterisk

Next we add the following two lines to sip.conf (or sip_custom.conf if you're using freepbx)

tcpenable=yes
transport=tcp

Do a

sip reload

on the asterisk console, and you should be good to go.

That's it. Configure your SIP clients to use TCP, or both TCP & UDP, depending on packet size (the auto setting on some clients), and start making calls. In particular this works with the nokia voip client (tested on E65 in both TCP & Auto modes).

, ,

  1. #1 by Bricky on October 19, 2007 - 11:04 pm

  2. #2 by Doug on November 24, 2007 - 3:18 am

    Hi,
    I tried to upgrade the TCP support on my 1.2.24 Asterisk/Trixbox system. It seems like everything worked. But I am not Linux knowledgable.

    When I tried to start Asterisk it just did not start.

    I have a text file of the start of Asterisk and didn’t see anything obvious.

    I was running in a VMware machine and had a backup. I also backed up the VM that has the TCP patch so I can start it to try and determine the problem.

    Any help is appreciated.

    I wish I was more helpful in identifying the problem. If you could tell me what to try or do to get any information for you, let me know.

    Can you help?
    Doug

  3. #3 by Bricky on November 24, 2007 - 4:20 am

    I’m not very familiar with trixbox Doug, but I’ll give whatever help I can :)

    First things first: What’s the output of

    asterisk -vvvc

    And did the patch run successfully? (any warnings or errors?)

  4. #4 by EricP56 on February 20, 2008 - 5:39 am

    I tried this, and TCP is loaded by Asterisk. That’s great. But when I add transport=tcp in the PEER settings for a trunk, the trunk stops working. Anybody else run into this?

  5. #5 by Syed on August 12, 2008 - 3:37 pm

    I’m using Asterisk 1.4.xx, will this patch work with newer version?

  6. #6 by Bricky on September 9, 2008 - 11:47 pm

    No, this is a patch for the 1.2 branch only. There is a patch for the 1.4 branch though, have a look here.

    It’s probably worth mentioning that the (beta) 1.6 branch now has a completely re-written sip stack, with (somewhat buggy) tcp support too.

    Note: anyone looking for production-quality sip tcp support is probably better off to stay away from asterisk altogether. Preferable alternatives are openser and freeswitch.

(will not be published)


css.php