Поделиться через


NAT Address Mapping (Windows Embedded CE 6.0)

1/6/2010

If an RTC client is behind a NAT, make sure of the following:

  • Two ports for each audio stream are opened on the NAT so media can be forwarded to the client machine.
  • The client IP address are mapped to an IP address on the NAT so the NAT can forward the media stream to the correct device.

If the NAT supports the Universal Plug and Play (UPnP) Internet Gateway Device (IGD) device control profile (DCP), the RTC Client API provides NAT mappings. This is the default behavior of the API, and is explained in more detail in Firewalls and NATs and Traversal of NATs.

Implementing Port Manager Functionality

When the client is behind a NAT that does not support the UPnP IGD DCP, the client application must provide a means to map the IP addresses and ports on the NAT to those on the client machine. It does this by implementing a Port Manager.

The Port Manager is a component of the application using RTC that provides the port mapping for the RTC Client API.

To set up port mappings, an application calls IUnknown::QueryInterface on any IRTCSession or IRTCSession2 reference to obtain a reference to the IRTCSessionPortManagement interface.

The single IRTCSessionPortManagement method is IRTCSessionPortManagement::SetPortManager. The client uses this method to specify a callback interface (represented by IRTCPortManager) that is used by the RTC Client API to obtain port mappings from the application.

The client application must provide a port manager before it initiates the session using IRTCSession::AddParticipant. If NAT mappings are not in place when a session is initiated, the desired media streams cannot be transmitted.

Given the address of the remote endpoint and the media type, the client application's implementation of the IRTCPortManager::GetMapping method must return the IP address and port on the client as well as the external IP address and port on the NAT.

Note

The application should be prepared to return the port mappings immediately after the application calls SetPortManager.

The external address and port on the NAT are used in the Session Description Protocol (SDP) of the SIP INVITE message generated when a participant is added to the session.

IRTCPortManager3 is a newly extended interface in RTC 1.5. Besides the existing dependency on the address pair, the methods in this extension include dependency on the remote client’s port as well as the transport used.

IRTCProfilePortManagement is a newly added interface in RTC 1.5. This interface uses the SetPortManager method, which is the same method as used in IRTCSessionPortManagement.

For details about how to initiate a session using the Port Manager interfaces, see Client Application Behind a NAT.

See Also

Concepts

Firewalls and NATs