Platform SDK: Web Telephony Engine

Controlling Media Transport during a Call

A TAPI 3.0 device supports a component called the media service provider (MSP) that controls the media stream for the device. The MSP provides a programming interface consisting of a set of COM objects that applications can use to control media transport during a call. You can access these objects from a WTE application by using scripts. For more information about the MSP, see Microsoft Telephony Overview.

An MSP object that is particularly useful in a WTE application is the Stream object. An application can use this object to retrieve information about a media stream, to start, pause, or stop the stream, and to select or unselect terminals on a stream. A WTE application can retrieve a collection of all currently available Stream objects by following these steps:

To retrieve the Stream collection

  1. Retrieve an instance of the DispatchMapper object.
  2. Use the DispatchMapper.QueryDispatchInterface method to retrieve an instance of the StreamControl object supported by the MSP. When calling QueryDispatchInterface, you must specify the GUID of the StreamControl object and a reference to the ITBasicCallControl object.
  3. Use the StreamControl.Streams property to retrieve a collection of all media streams that are currently available.

The following example shows how to use VBScript to get the stream collection:

IIDStreamControl = "{EE3BD604-3868-11D2-A045-00C04FB6809F}"
Set myDispMapper = CreateObject("DispatchMapper.DispatchMapper.1")
Set myBasicCallControl = window.external.ITBasicCallControl
Set myStreamControl = myDispMapper.QueryDispatchInterface(IIDStreamControl, 
  myBasicCallControl)
Set myAllStreams=myStreamControl.Streams
For Each pITStream in myAllStreams
    stringOutput = "Found Stream: " & pITStream.MediaType
    MsgBox stringOutput
    window.external.LogCustomField.DefaultValue = stringOutput
    window.external.log()
    window.external.LogCustomField.DefaultValue = ""
    pITStream.StopStream
Next

The following example shows how to use JScript to get the stream collection:

IIDStreamControl = "{EE3BD604-3868-11D2-A045-00C04FB6809F}"; 
myDispMapper = new ActiveXObject("DispatchMapper.DispatchMapper.1");
myBasicCallControl = window.external.ITBasicCallControl;
myStreamControl = yDispMapper.QueryDispatchInterface(IIDStreamControl, 
  myBasicCallControl);
myAllStreams=myStreamControl.Streams; 
for (i = 1; i <= myAllStreams.Count; i++) {
    pITStream = myAllStreams.Item(i);
    stringOutput = "Stream is "+ typeof(pITStream);
    window.external.LogCustomField.DefaultValue=stringOutput;
    window.external.log();
    window.external.LogCustomField.DefaultValue = "";
    stringOutput = "Found Stream: " + pITStream.MediaType;
    window.external.LogCustomField.DefaultValue = stringOutput;
    window.external.log();
    window.external.LogCustomField.DefaultValue = "";
}