HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
Advanced Features 367
Multihomed Host
Local IP address as a string
Local port
When a request is sent, the local address is chosen according to the destination
transport and address types. For example, if a request destination is a TCP IPv6
address, the local address to use is also a TCP IPv6 address. Therefore, each of
the SIP Stack objects holds several local addresses for each combination of
transport and address types.
If you wish to set the local address of several transports, you should call the
RvSipXXXSetLocalAddress() function several times for each requested
combination. If, for example, a call-leg sends its initial request with TCP/IPv4
and further requests with UDP/IPv4, you may want to set both the TCP/IPv4
and the UDP/IPv4 local addresses.
Note The local address string you provide for the Set function must exactly
match the local address that was inserted in the configuration structure at the
initialization of the SIP Stack. If you configured the SIP Stack to listen to a 0.0.0.0
local address, you must use the same notation here.
If you do not set a local address to an object, the first suitable configured local
address will be used. If there is no suitable address, for example if you wish to
send a request with UDP/IPv6 address but did not define such a local address,
the request sending will fail.
The usage of a local address is different for the different transports.
In UDP, when the local address is set, the SIP Stack uses the socket bound to this
address to send the request.
In TCP/TLS, when the local outbound address is set, the SIP Stack matches a
listening address (one of the address given for TCP/TLS in the configuration)
and sets this address in the Via header of the message. The request will be sent
from the same address but from an ephemeral port number.
Note Only requests will be sent through the local address. Responses will always
be sent back through the same local address as their request. When TCP/TLS is
used, the response will use the same connection on which the request was
received. Only if this connection was closed for some reason will a new
connection be constructed.