Skip to main content

contact_for

Function contact_for 

Source
pub fn contact_for(endpoint: &Handle, transport: TransportKind) -> String
Expand description

The Contact this endpoint should advertise for a dialog on this transport.

Built from the endpoint’s advertised address rather than its socket’s local one. An endpoint bound to 0.0.0.0 has a local address that means nothing to a peer, and behind a NAT it is private — either way the peer stores it as the dialog’s remote target and every in-dialog request it sends becomes unroutable.

The transport matters because over a WebSocket there is no address to advertise at all: the endpoint gives the invented name RFC 7118 §5.2 requires, and marks the URI with the same transport token it puts in the Via, so a peer that does route on Contact knows not to try sip: on port 5060.