Share via


Programming Patterns with Media Connectivity Objects

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Two methods of adding media connectivity servers to an endpoint were discussed previously. Each method has advantages for an organization. If your organization has a stable network topology with a single MRAS and media connectivity server whose configuration settings are static, it is a good idea to create a configuration file on a client computer with appropriate connectivity configuration settings. Those settings can be read when an endpoint is configured. Using this method, the enabled endpoint does not poll the MRAS server for current media connectivity servers and configuration data. A media connectivity server is added to the enabled endpoint using the cached configuration.

The alternate method is useful when your organization network topology includes multiple media connectivity servers whose configuration is not static. Another scenario when the alternate method is useful is where your organization has many client computers. In this case, provisioning each computer with a configuration file and maintaining each file is not an optimal solution. Instead of reading configuration information from a client cache, an endpoint can be made to discover the location and configuration of each media connectivity server automatically. It is necessary to subscribe to a category of self-published data called serverConfiguration to get the location of an organization MRAS server. It is the MRAS server that provides an endpoint with the necessary media connectivity server information.

Adding a Media Connectivity Server to an Endpoint

The following programming patterns for the two methods discussed previously are outlined in the following section.

Add a Media Connectivity Server Using Local Computer Cache

  • In the class you use to handle endpoint functionality, implement the _IUccMediaEndpointEvents dispinterface. This dispinterface exposes a callback function you use to receive a collection of located media connectivity servers.

  • Obtain an IUccMediaEndpointSettings interface from an enabled endpoint. If you have created a proxy endpoint for remote call control functionality, you must not attempt to obtain the media endpoint settings interface from the proxy endpoint.

  • Advise for media endpoint events with the class you have implemented _IUccMediaEndpointEvents as the event sink and the enabled endpoint used to obtain the media endpoint settings interface as the source of the events.

  • Create the server using cached data.

    Note

    If a single media relay server is configured for multiple protocols, each media connectivity server configured for the media endpoint at that Address must use the same Priority.

Add a Media Connectivity Server Using MRAS Information

  • In the class you use to handle endpoint functionality, implement the _IUccMediaEndpointEvents dispinterface. This dispinterface exposes a callback function you use to receive a collection of located media connectivity servers.
  • Obtain an IUccMediaEndpointSettings interface from an enabled endpoint. If you have created a proxy endpoint for remote call control functionality, you must not attempt to obtain the media endpoint settings interface from the proxy endpoint.
  • Advise for media endpoint events with the class you have implemented _IUccMediaEndpointEvents as the event sink and the enabled endpoint used to obtain the media endpoint settings interface as the source of the events.
  • Call FindMediaConnectivityServers on the media endpoint settings interface. The first argument position is a string representing the URI of an organization MRAS server. This value is provisioned on a client when the client subscribes to the serverConfiguration category. For information about this category, see IUccServerConfigurationCategory.
  • Within the OnFindMediaConnectivityServers callback function, iterate on the IUccCollection of located media connectivity server objects. Because the collection items are returned as Object types, it is necessary to call QueryInterface or cast the object to the IUccMediaConnectivityServerConfiguration interface. To add the located media connectivity server to the enabled endpoint, simply call AddMediaConnectivityServerWithCredential, passing the obtained interface in the first argument position.

Set a Port Range

Setting a port range for computer ports reserved by other processes results in a COM exception. Generally, port numbers below 1000 are reserved by an operating system. To avoid the processing cost of raising an exception, validate the requested port range before attempting to set the range. The minimum requirements for audio + video sessions are four ports (two ports for audio and two ports for video). Normally you set a range of 20 ports to be available to prevent the possible failure of an A/V session due to lack of available ports. A client can carry on multiple A/V sessions concurrently, each session using ports in the range set aside for the media stack.

See Also

Concepts

Media Endpoint Settings Interface
Media Connectivity Server Interface