Details

    • Type: New Feature New Feature
    • Status: Closed
    • Severity: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Target Release Version/s: None
    • Component/s: None
    • Labels:
      None
    • SVN Revision Number:
      46875
    • Mantis ID:
      4903
    • Regression:
      No

      Description

      I added TCP support to asterisk SIP channel. I put all my changes under #ifdef SIP_TCP_SUPPORT and left the original code. So if you search SIP_TCP_SUPPORT, you can find my changes very easily.

      My changes
      -Added TCP listening socket, siptcpsock.
      -Added securechannel, sockfd, transport field to struct sip_pvt.
      -Added transport, tcpsockfd field to struct sip_peer.
      -Added TCP read in sipsock_read().
      -Added siptcp_accept() to accept an incoming TCP connection request.
      -Added transport, q parameter processing in Contact header parsing.
      -Changed the hard-coded "UDP" in Via header to copy sip_pvt.transport.
      -Added tcp_conenct() to make a TCP connection for outgoing message.
      -Added TCP transmit in __sip_xmit().
      -Saved TCP connecton socket to sip_peer.tcpsockfd, copied it to sip_pvt.sockfd when OPTIONS or INVITE is sent to the peer that is using TCP.

      I tested it mainly xlite(UDP only free version) and Jain-SIP communicator. call signal is working well. One problem I am having is Jain-SIP communicator doesn't receive any audio, I don't know why. If any one has xlite-pro(TCP supported commercial version) or TCP supported SIP clients, I am looking forward to hear the test result.

      Welcome any comment.
      Thanks

                • ADDITIONAL INFORMATION ******

      = debug snipped by vechers and moved to hjlee-debug-original.txt =

      1. asterisk-1.2.10-20060821-tcp.patch
        57 kB
      2. asterisk-1.2.12.1-20060919-tcp.patch
        58 kB
      3. asterisk-1.2.13-20061102-tcp.patch
        57 kB
      4. asterisk-1.2.13-20061203-tcp.diff.patch
        58 kB
      5. asterisk-1.2.14-1-tcp.patch
        58 kB
      6. asterisk-1.2.24-tcp-patch
        58 kB
        Dinesh Nair
      7. asterisk-1.2.4-tcp.patch
        39 kB
      8. asterisk-1.2.6-tcp.patch
        39 kB
      9. asterisk-1.2.7.1-tcp.patch
        56 kB
      10. asterisk-20060822-tcp.patch
        39 kB
      11. asterisk-20060823-tcp.patch
        39 kB
      12. asterisk-20060912c-tcp.patch
        39 kB
      13. asterisk-20061102-tcp.patch
        41 kB
      14. asterisk-20061212-tcp.patch
        42 kB
      15. chan_sip.c
        380 kB
      16. hjlee-debug-original.txt
        5 kB
      17. Shootist.java
        11 kB
      18. Shootist-0.1.java
        17 kB
      19. sip-20070808-1.4.9.tcp
        14 kB
        Gregory Hinton Nietsky
      20. siptcpchanges.patch
        800 kB
      21. siptcpchanges-1.0.9.patch
        27 kB
      22. siptcpchanges-1.0.9-latest.patch
        39 kB
      23. siptcpchanges2.patch
        18 kB
      24. siptlschanges.patch
        797 kB
      25. SoC-Final-siptcpchanges.patch
        803 kB
      26. SoC-Final-siptcpchanges-1.0.9.patch
        43 kB
      27. tcptest_20061207.txt
        3 kB
      28. tcptest_20061212.txt
        3 kB
      29. test.xml
        2 kB
      30. TLS-asterisk.log
        12 kB
      31. TLS-registration-invite.cap
        18 kB

        Activity

        Hide
        Michiel van Baak added a comment -

        alphaque: Can you provide a patch against current svn trunk ?
        As serge-v stated several times this is a new feature and should be developed for trunk, not a release (1.2 or 1.4)

        Show
        Michiel van Baak added a comment - alphaque: Can you provide a patch against current svn trunk ? As serge-v stated several times this is a new feature and should be developed for trunk, not a release (1.2 or 1.4)
        Hide
        Dinesh Nair added a comment -

        mvanbaak, i provided the patch against 1.2.x because that is run and to have this on mantis for those still running 1.2.x. i do know that it wont be committed into the 1.2.x branch.

        unfortunately, my 1.4.x kungfu is not yet strong enough for me to make the necessary changes for a patch to 1.4.x. hopefully someone could extend the 1.2.x patch for 1.4.x in some foreseeable future.

        Show
        Dinesh Nair added a comment - mvanbaak, i provided the patch against 1.2.x because that is run and to have this on mantis for those still running 1.2.x. i do know that it wont be committed into the 1.2.x branch. unfortunately, my 1.4.x kungfu is not yet strong enough for me to make the necessary changes for a patch to 1.4.x. hopefully someone could extend the 1.2.x patch for 1.4.x in some foreseeable future.
        Hide
        james.chiang added a comment -

        I get some sip over tcp problem with the patch to access exchange 2007 UM.

        Porblem: Can't received sip over tcp packet from sipsock_read when UM not reply the tcp ack after asterisk request invite.

        P.S In this case eyebem and sipx both are work well.

        Success flow as folling
        1.asterisk: tcp syn ack
        2.UM : tcp ack
        3.asterisk: sip over tcp invite
        4.UM : tcp ack
        5.UM : sip over tcp 100 trying
        6.UM : sip over tcp 180 ringing
        7.UM : sip over tcp 200 ok

        Failure flow as folling
        1.asterisk: tcp syn ack
        2.UM : tcp ack
        3.asterisk: sip over tcp invite
        4.UM : sip over tcp 100 trying
        5.UM : sip over tcp 180 ringing – missed
        6.UM : sip over tcp 200 ok – missed

        Any help would be appreciated.

        Thanks,
        James

        Show
        james.chiang added a comment - I get some sip over tcp problem with the patch to access exchange 2007 UM. Porblem: Can't received sip over tcp packet from sipsock_read when UM not reply the tcp ack after asterisk request invite. P.S In this case eyebem and sipx both are work well. Success flow as folling 1.asterisk: tcp syn ack 2.UM : tcp ack 3.asterisk: sip over tcp invite 4.UM : tcp ack 5.UM : sip over tcp 100 trying 6.UM : sip over tcp 180 ringing 7.UM : sip over tcp 200 ok Failure flow as folling 1.asterisk: tcp syn ack 2.UM : tcp ack 3.asterisk: sip over tcp invite 4.UM : sip over tcp 100 trying 5.UM : sip over tcp 180 ringing – missed 6.UM : sip over tcp 200 ok – missed Any help would be appreciated. Thanks, James
        Hide
        Raj Jain added a comment -

        I haven't studied this patch in great detail. However, one thing about supporting SIP-over-TCP is that it is much more than delineating SIP messages in a TCP byte stream. There are quite a few issues that one needs to grapple with. Some of us wrote an internet-draft in the IETF to provide guidelines to implementers who wish to develop SIP over connection-oriented transport protocols such as TCP and SCTP:

        http://www.croczilla.com/zap/rfcs/draft-gurbani-sipping-connection-guidelines-01.txt

        In general, SIP-over-TCP implementations face some major issues such as the following:

        1. NAT Traversal: The problem of SIP NAT traversal is much worst w/ TCP than w/ UDP. Basically, you'll have to always initiate the TCP connection from the client sitting behind the NAT and keep it open otherwise the NAT will block the call from Asterisk to user/peer. The I-D below discusses this topic in plenty detail:

        http://www.ietf.org/internet-drafts/draft-ietf-sip-outbound-10.txt

        2. The need for persistent-connections becomes really important when you run SIP/TLS/TCP. The issue is latency introduced in TLS connection establishments which will add to post-dial latency. So, this becomes a pretty critical requirement for SIP trunking scenarios. The I-D below discusses this topic (it proposes using LRU for managing TCP sockets and also offers a nice optimization that allows you to use one TCP socket for transactions in opposite directions):

        http://www.ietf.org/internet-drafts/draft-ietf-sip-connect-reuse-08.txt

        If someone has given any thought to these issues with respect to SIP-over-TCP support in Asterisk then please share your insight.

        Show
        Raj Jain added a comment - I haven't studied this patch in great detail. However, one thing about supporting SIP-over-TCP is that it is much more than delineating SIP messages in a TCP byte stream. There are quite a few issues that one needs to grapple with. Some of us wrote an internet-draft in the IETF to provide guidelines to implementers who wish to develop SIP over connection-oriented transport protocols such as TCP and SCTP: http://www.croczilla.com/zap/rfcs/draft-gurbani-sipping-connection-guidelines-01.txt In general, SIP-over-TCP implementations face some major issues such as the following: 1. NAT Traversal: The problem of SIP NAT traversal is much worst w/ TCP than w/ UDP. Basically, you'll have to always initiate the TCP connection from the client sitting behind the NAT and keep it open otherwise the NAT will block the call from Asterisk to user/peer. The I-D below discusses this topic in plenty detail: http://www.ietf.org/internet-drafts/draft-ietf-sip-outbound-10.txt 2. The need for persistent-connections becomes really important when you run SIP/TLS/TCP. The issue is latency introduced in TLS connection establishments which will add to post-dial latency. So, this becomes a pretty critical requirement for SIP trunking scenarios. The I-D below discusses this topic (it proposes using LRU for managing TCP sockets and also offers a nice optimization that allows you to use one TCP socket for transactions in opposite directions): http://www.ietf.org/internet-drafts/draft-ietf-sip-connect-reuse-08.txt If someone has given any thought to these issues with respect to SIP-over-TCP support in Asterisk then please share your insight.
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 99085

        U trunk/CHANGES
        U trunk/CREDITS
        U trunk/channels/chan_sip.c
        U trunk/configs/sip.conf.sample
        A trunk/doc/siptls.txt
        U trunk/include/asterisk/http.h
        A trunk/include/asterisk/tcptls.h
        U trunk/main/Makefile
        U trunk/main/http.c
        U trunk/main/manager.c
        A trunk/main/tcptls.c

        ------------------------------------------------------------------------
        r99085 | russell | 2008-01-18 16:02:03 -0600 (Fri, 18 Jan 2008) | 13 lines

        Merge changes from team/group/sip-tcptls

        This set of changes introduces TCP and TLS support for chan_sip. There are various
        new options in configs/sip.conf.sample that are used to enable these features. Also,
        there is a document, doc/siptls.txt that describes some things in more detail.

        This code was implemented by Brett Bryant and James Golovich. It was reviewed
        by Joshua Colp and myself. A number of other people participated in the testing
        of this code, but since it was done outside of the bug tracker, I do not have their
        names. If you were one of them, thanks a lot for the help!

        (closes issue ASTERISK-4778, but with completely different code that what exists there.)

        ------------------------------------------------------------------------

        http://svn.digium.com/view/asterisk?view=rev&revision=99085

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 99085 U trunk/CHANGES U trunk/CREDITS U trunk/channels/chan_sip.c U trunk/configs/sip.conf.sample A trunk/doc/siptls.txt U trunk/include/asterisk/http.h A trunk/include/asterisk/tcptls.h U trunk/main/Makefile U trunk/main/http.c U trunk/main/manager.c A trunk/main/tcptls.c ------------------------------------------------------------------------ r99085 | russell | 2008-01-18 16:02:03 -0600 (Fri, 18 Jan 2008) | 13 lines Merge changes from team/group/sip-tcptls This set of changes introduces TCP and TLS support for chan_sip. There are various new options in configs/sip.conf.sample that are used to enable these features. Also, there is a document, doc/siptls.txt that describes some things in more detail. This code was implemented by Brett Bryant and James Golovich. It was reviewed by Joshua Colp and myself. A number of other people participated in the testing of this code, but since it was done outside of the bug tracker, I do not have their names. If you were one of them, thanks a lot for the help! (closes issue ASTERISK-4778 , but with completely different code that what exists there.) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=99085

          Dates

          • Created:
            Updated:
            Resolved:

            Development