Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column

Sending Messages

 

The process by which an underlying transport is chosen for sending of a message is broken up into different steps depending on the type of message.

SIP Request Handling

1. URI Parsing

 The PJSIP stack fundamentally acts on URIs. When sending to a URI it is parsed into the various parts (user, host, port, user parameters). For the purposes of transport selection the transport parameter is examined. This specifies the type of transport. If this parameter is not present it is assumed to be UDP. This is important because it is used in DNS resolution. If a "sips" URI scheme is used an automatic switchover to TLS will occur.

2. DNS SRV Resolution (If host portion is not an IP address)

The transport type from above is used to determine which SRV record to look up. This means that the original URI *must* include the transport type for TCP and TLS types UNLESS the "sips" URI scheme is used which automatically switches to TLS.

3a. Transport Selection (No explicit transport provided)

Now that the underlying type of transport is known and the resolved target exists the transport selection process can begin.

Connection-less protocols (such as UDP)

A transport, decided upon by a hashing mechanism, matching the transport type and address family is selected.

Connection-oriented protocols (such as TCP or TLS)

An already open connection to the resolved IP address and port is searched for. If the connection exists it is reused for the request. If no connection exists the first transport matching the transport type and address family as configured in pjsip.conf is chosen. It is instructed to establish a new connection to the resolved IP address and port.

Column
Panel
titleOn this Page

Table of Contents
maxLevel2

...

 

Code Block
[system-internet-udp]
type=transport
protocol=udp
bind=5.5.5.5


[system-internet-tcp]
type=transport
protocol=tcp
bind=5.5.5.5


[system-local-udp]
type=transport
protocol=udp
bind=192.168.1.1


[system-udp-tcp]
type=transport
protocol=tcp
bind=192.168.1.1
 
[phone-internet]
type=endpoint
transport=system-internet-udp
 
 
[phone-local]
type=endpoint
transport=system-local-udp

 

This example includes two endpoints which are each present on different networks. To ensure that outgoing requests to each endpoint travel over the correct transport the transport has been explicitly specified on each.

IPv6 Only (Single Interface)

...

Warning

It might be tempting to use a wildcard IPv6 address to bind a single transport to allow both IPv6 and IPv4. In this configuration IPv6 mapped IPv4 addresses will be used which is unsupported by PJSIP. This will cause a SIP message parsing failure.

Common Issues

...