The provided transport is instructed to establish a new connection to the resolved IP address and port.
If an existing connection exists to the IP address and port using the specific transport type then it is reused and a new one is not established.
4. Multihomed Transport Selection (Connection-less protocols)
If no connection exists or the connection is no longer open the first configured transport in pjsip.conf matching the transport type and address family is selected. It is instructed to establish a new connection to the destination IP address and port.
Connection-less protocol with maddr in URI of the topmost Via header
Connection-less protocol with rport in URI of the topmost Via header
Connection-less protocol without rport in URI of the topmost Via header
2. Message is sent
Configure a wildcard transport:. This is simple as it requires no special configuration such as knowing the IP address and has no downsides.
[system-udp] type=transport protocol=udp bind=0.0.0.0 [system-tcp] type=transport protocol=tcp bind=0.0.0.0 [system-tls] type=transport protocol=tls bind=0.0.0.0:5061 cert_file=certificate [phone] type=endpoint
This example includes an endpoint without a transport explicitly defined. Since there is only one transport configured for each address family and transport type each respective one will be used depending on the URI dialed. For requests to this endpoint the logic in section 3a will be used.
IPv4 Only (Multiple Interfaces)
[system-internet-udp] type=transport protocol=udp bind=126.96.36.199 [system-internet-tcp] type=transport protocol=tcp bind=188.8.131.52 [system-internet-tls] type=transport protocol=tls bind=184.108.40.206:5061 cert_file=certificate [system-local-udp] type=transport protocol=udp bind=192.168.1.1 [system-udplocal-tcp] type=transport protocol=tcp bind=192.168.1.1 [system-local-tls] type=transport protocol=tls bind=192.168.1.1:5061 cert_file=certificate [phone-internet] type=endpoint transport=system-internet-udp [phone-local] type=endpoint transport=system-local-udp [phone-unspecified] type=endpoint
This example includes three endpoints which are each present on different networks. To ensure that outgoing requests to the first two endpoints travel over the correct transport the transport has been explicitly specified on each. For requests to these endpoints the logic in section 3b will be used. For requests to the "phone-unspecified" endpoint since no transport has been explicitly specified the logic in section 3a will be used.
IPv6 Only (Single Interface)
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.