Sending large SIP packets over UDP?

JL
Johan Lantz
Tue, Jan 27, 2009 2:21 PM

Hi all

I have a two questions regarding TCP/UDP transports, the first one is
probably simple:

  1. How do I force pjsip to use TCP for outgoing requests. I have
    configured two transports, one for TCP and one for UDP. Both calls to
    pjsua_transport_create(..) return successfully but all messages are
    always sent on UDP. I found some old posts on that ;transport=tcp should
    be added so I did this and it can be seen in the Request-Line. However
    the INVITE packet is always sent over UDP anyway. What do I need to do
    to properly force usage of TCP for outgoing requests?

  2. We have encountered a problem which we have most likely narrowed down
    to payload size when transmitting over UDP. From a Windows Mobile phone
    connected over WiFi sending arbitrary INVITES always work but when we
    connect over 3G the successrate is random once the packet size gets to
    large. RFC 3261 states that TCP should be used for packages larger then
    1300 bytes so one guess here is that somewhere in the 3G network our
    packages are discarded when they get to large. I need assistance with if
    the problem is due to my TCP transport is not properly configured or if
    18.1.1. below is not handled by pjsip they way I interpret it. Does
    pjsip cater for switching to TCP like specified below?

RFC 3261 states the following:
(18.1.1 Sending Requests) :  If a request is within 200 bytes of the
path MTU, or if it is larger
than 1300 bytes and the path MTU is unknown, the request MUST be sent
using an RFC 2914 [43] congestion controlled transport protocol, such
as TCP. If this causes a change in the transport protocol from the
one indicated in the top Via, the value in the top Via MUST be
changed.  This prevents fragmentation of messages over UDP and
provides congestion control for larger messages.  However,
implementations MUST be able to handle messages up to the maximum
datagram packet size.  For UDP, this size is 65,535 bytes, including
IP and UDP headers.

Thanks

Johan

Hi all I have a two questions regarding TCP/UDP transports, the first one is probably simple: 1. How do I force pjsip to use TCP for outgoing requests. I have configured two transports, one for TCP and one for UDP. Both calls to pjsua_transport_create(..) return successfully but all messages are always sent on UDP. I found some old posts on that ;transport=tcp should be added so I did this and it can be seen in the Request-Line. However the INVITE packet is always sent over UDP anyway. What do I need to do to properly force usage of TCP for outgoing requests? 2. We have encountered a problem which we have most likely narrowed down to payload size when transmitting over UDP. From a Windows Mobile phone connected over WiFi sending arbitrary INVITES always work but when we connect over 3G the successrate is random once the packet size gets to large. RFC 3261 states that TCP should be used for packages larger then 1300 bytes so one guess here is that somewhere in the 3G network our packages are discarded when they get to large. I need assistance with if the problem is due to my TCP transport is not properly configured or if 18.1.1. below is not handled by pjsip they way I interpret it. Does pjsip cater for switching to TCP like specified below? RFC 3261 states the following: (18.1.1 Sending Requests) : If a request is within 200 bytes of the path MTU, or if it is larger than 1300 bytes and the path MTU is unknown, the request MUST be sent using an RFC 2914 [43] congestion controlled transport protocol, such as TCP. If this causes a change in the transport protocol from the one indicated in the top Via, the value in the top Via MUST be changed. This prevents fragmentation of messages over UDP and provides congestion control for larger messages. However, implementations MUST be able to handle messages up to the maximum datagram packet size. For UDP, this size is 65,535 bytes, including IP and UDP headers. Thanks Johan
RD
Ramesh D
Tue, Jan 27, 2009 6:58 PM

Johan,

Does your 3G provider support mobile IP? May the mobile IP over 3G is causing the difference in behaviour.

Ramesh


From: Johan Lantz johan.lantz@genaker.net
To: pjsip@lists.pjsip.org
Sent: Tuesday, January 27, 2009 9:21:01 AM
Subject: [pjsip] Sending large SIP packets over UDP?

Hi all

I have a two questions regarding TCP/UDP transports, the first one is probably simple:

  1. How do I force pjsip to use TCP for outgoing requests. I have configured two transports, one for TCP and one for UDP. Both calls to pjsua_transport_create(..) return successfully but all messages are always sent on UDP. I found some old posts on that ;transport=tcp should be added so I did this and it can be seen in the Request-Line. However the INVITE packet is always sent over UDP anyway. What do I need to do to properly force usage of TCP for outgoing requests?

  2. We have encountered a problem which we have most likely narrowed down to payload size when transmitting over UDP. From a Windows Mobile phone connected over WiFi sending arbitrary INVITES always work but when we connect over 3G the successrate is random once the packet size gets to large. RFC 3261 states that TCP should be used for packages larger then 1300 bytes so one guess here is that somewhere in the 3G network our packages are discarded when they get to large. I need assistance with if the problem is due to my TCP transport is not properly configured or if 18.1.1. below is not handled by pjsip they way I interpret it. Does pjsip cater for switching to TCP like specified below?

RFC 3261 states the following:
(18.1.1 Sending Requests) :  If a request is within 200 bytes of the path MTU, or if it is larger
  than 1300 bytes and the path MTU is unknown, the request MUST be sent
  using an RFC 2914 [43] congestion controlled transport protocol, such
  as TCP. If this causes a change in the transport protocol from the
  one indicated in the top Via, the value in the top Via MUST be
  changed.  This prevents fragmentation of messages over UDP and
  provides congestion control for larger messages.  However,
  implementations MUST be able to handle messages up to the maximum
  datagram packet size.  For UDP, this size is 65,535 bytes, including
  IP and UDP headers.

Thanks

Johan


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Johan, Does your 3G provider support mobile IP? May the mobile IP over 3G is causing the difference in behaviour. Ramesh ________________________________ From: Johan Lantz <johan.lantz@genaker.net> To: pjsip@lists.pjsip.org Sent: Tuesday, January 27, 2009 9:21:01 AM Subject: [pjsip] Sending large SIP packets over UDP? Hi all I have a two questions regarding TCP/UDP transports, the first one is probably simple: 1. How do I force pjsip to use TCP for outgoing requests. I have configured two transports, one for TCP and one for UDP. Both calls to pjsua_transport_create(..) return successfully but all messages are always sent on UDP. I found some old posts on that ;transport=tcp should be added so I did this and it can be seen in the Request-Line. However the INVITE packet is always sent over UDP anyway. What do I need to do to properly force usage of TCP for outgoing requests? 2. We have encountered a problem which we have most likely narrowed down to payload size when transmitting over UDP. From a Windows Mobile phone connected over WiFi sending arbitrary INVITES always work but when we connect over 3G the successrate is random once the packet size gets to large. RFC 3261 states that TCP should be used for packages larger then 1300 bytes so one guess here is that somewhere in the 3G network our packages are discarded when they get to large. I need assistance with if the problem is due to my TCP transport is not properly configured or if 18.1.1. below is not handled by pjsip they way I interpret it. Does pjsip cater for switching to TCP like specified below? RFC 3261 states the following: (18.1.1 Sending Requests) :  If a request is within 200 bytes of the path MTU, or if it is larger   than 1300 bytes and the path MTU is unknown, the request MUST be sent   using an RFC 2914 [43] congestion controlled transport protocol, such   as TCP. If this causes a change in the transport protocol from the   one indicated in the top Via, the value in the top Via MUST be   changed.  This prevents fragmentation of messages over UDP and   provides congestion control for larger messages.  However,   implementations MUST be able to handle messages up to the maximum   datagram packet size.  For UDP, this size is 65,535 bytes, including   IP and UDP headers. Thanks Johan _______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@lists.pjsip.org http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
BP
Benny Prijono
Wed, Jan 28, 2009 11:46 AM

On Tue, Jan 27, 2009 at 2:21 PM, Johan Lantz johan.lantz@genaker.netwrote:

Hi all

I have a two questions regarding TCP/UDP transports, the first one is
probably simple:

  1. How do I force pjsip to use TCP for outgoing requests. I have configured
    two transports, one for TCP and one for UDP. Both calls to
    pjsua_transport_create(..) return successfully but all messages are always
    sent on UDP. I found some old posts on that ;transport=tcp should be added
    so I did this and it can be seen in the Request-Line. However the INVITE
    packet is always sent over UDP anyway. What do I need to do to properly
    force usage of TCP for outgoing requests?

TCP is used if the next hop is set to use TCP, and next hop is calculated
from either Request URI or Route header. So you probably have route set that
still uses UDP. Please see http://trac.pjsip.org/repos/wiki/FAQ#tcp

  1. We have encountered a problem which we have most likely narrowed down to

payload size when transmitting over UDP. From a Windows Mobile phone
connected over WiFi sending arbitrary INVITES always work but when we
connect over 3G the successrate is random once the packet size gets to
large. RFC 3261 states that TCP should be used for packages larger then 1300
bytes so one guess here is that somewhere in the 3G network our packages are
discarded when they get to large. I need assistance with if the problem is
due to my TCP transport is not properly configured or if 18.1.1. below is
not handled by pjsip they way I interpret it. Does pjsip cater for switching
to TCP like specified below?

No we don't do automatic switching to TCP. Personally I feel that the RFC is
a bit too naive in this regard, ignoring scenarios such as NAT where you
can't just send response with TCP back to the client and expect it to just
work. So my take on this is if you think message size is going to cause
problem with UDP, then you should use TCP from the start.

cheers
Benny

RFC 3261 states the following:
(18.1.1 Sending Requests) :  If a request is within 200 bytes of the path
MTU, or if it is larger
than 1300 bytes and the path MTU is unknown, the request MUST be sent
using an RFC 2914 [43] congestion controlled transport protocol, such
as TCP. If this causes a change in the transport protocol from the
one indicated in the top Via, the value in the top Via MUST be
changed.  This prevents fragmentation of messages over UDP and
provides congestion control for larger messages.  However,
implementations MUST be able to handle messages up to the maximum
datagram packet size.  For UDP, this size is 65,535 bytes, including
IP and UDP headers.

Thanks

Johan


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

On Tue, Jan 27, 2009 at 2:21 PM, Johan Lantz <johan.lantz@genaker.net>wrote: > Hi all > > I have a two questions regarding TCP/UDP transports, the first one is > probably simple: > > 1. How do I force pjsip to use TCP for outgoing requests. I have configured > two transports, one for TCP and one for UDP. Both calls to > pjsua_transport_create(..) return successfully but all messages are always > sent on UDP. I found some old posts on that ;transport=tcp should be added > so I did this and it can be seen in the Request-Line. However the INVITE > packet is always sent over UDP anyway. What do I need to do to properly > force usage of TCP for outgoing requests? > > TCP is used if the next hop is set to use TCP, and next hop is calculated from either Request URI or Route header. So you probably have route set that still uses UDP. Please see http://trac.pjsip.org/repos/wiki/FAQ#tcp 2. We have encountered a problem which we have most likely narrowed down to > payload size when transmitting over UDP. From a Windows Mobile phone > connected over WiFi sending arbitrary INVITES always work but when we > connect over 3G the successrate is random once the packet size gets to > large. RFC 3261 states that TCP should be used for packages larger then 1300 > bytes so one guess here is that somewhere in the 3G network our packages are > discarded when they get to large. I need assistance with if the problem is > due to my TCP transport is not properly configured or if 18.1.1. below is > not handled by pjsip they way I interpret it. Does pjsip cater for switching > to TCP like specified below? > > No we don't do automatic switching to TCP. Personally I feel that the RFC is a bit too naive in this regard, ignoring scenarios such as NAT where you can't just send response with TCP back to the client and expect it to just work. So my take on this is if you think message size is going to cause problem with UDP, then you should use TCP from the start. cheers Benny > RFC 3261 states the following: > (18.1.1 Sending Requests) : If a request is within 200 bytes of the path > MTU, or if it is larger > than 1300 bytes and the path MTU is unknown, the request MUST be sent > using an RFC 2914 [43] congestion controlled transport protocol, such > as TCP. If this causes a change in the transport protocol from the > one indicated in the top Via, the value in the top Via MUST be > changed. This prevents fragmentation of messages over UDP and > provides congestion control for larger messages. However, > implementations MUST be able to handle messages up to the maximum > datagram packet size. For UDP, this size is 65,535 bytes, including > IP and UDP headers. > > Thanks > > Johan > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >