This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for

This function enables and disables the detection of media types (modes) on the specified call. When a media type is detected, a message is sent to the application.


LONG WINAPI lineMonitorMedia(



Handle to the call. The call state of hCallcan be any state except idle.


Media types to be monitored. A value of zero for the dwMediaModesparameter cancels all media type detection. This parameter uses one or more of the LINEMEDIAMODEconstants.

Return Value

Returns zero if the request succeeds or a negative error number if an error occurs. The following table shows the return values for this function.

Value Description


The handle to the call is invalid.


The operation is invalid.


The call state of hCallis idle.


The operation failed.


The media mode is invalid.


The resource is unavailable.


Not enough memory is available.


A parameter is uninitialized.


The media types specified with the lineOpenfunction relate only to enabling the detection of these media types by the service provider for the purpose of handing off new incoming calls to the proper application. They do not impact any of the media-mode notification messages that are expected because of a previous invocation of lineMonitorMedia.

This function is considered successful if media type monitoring has been correctly initiated, not when media type monitoring has terminated. Media monitoring for a given media type remains in effect until it is explicitly disabled by calling lineMonitorMediawith a dwMediaModesparameter set to zero, until the call transitions to idle, or when the application deallocates its call handle for the call. The lineMonitorMediafunction is primarily an event reporting mechanism. The media type (mode) of the call, as indicated in LINECALLINFO, is not affected by the service provider's detection of the media type. Only the controlling application can change a call's media type.

Default media monitoring performed by the service provider corresponds to the union of all media types specified on lineOpen.

Although this function can be invoked in any call state, a call's media type can typically only be detected while the call is in certain call states. These states can be device specific. For example, in ISDN, a message can indicate the media type of the media stream before the media stream exists. Similarly, distinctive ringing or the called identifier information about the call can be used to identify the media type of a call. Otherwise, the call may have to be answered (call in the connected state) to allow a service provider to determine the call's media type by filtering the media stream. Because filtering a call's media stream implies a computational overhead, applications should disable media monitoring when not required. By default, media monitoring is enabled for newly incoming calls, because a call's media type selects the application that should handle the call.

An outgoing application that deals with voice media types may want to monitor the call for silence (a tone) to distinguish who or what is at the called end of a call. For example, a person at home can answer calls with just a short "hello." A person in the office can provide a longer greeting, indicating name and company name. An answering machine can typically have an even longer greeting.

Because media-mode detection enabled by lineMonitorMediais implemented as a read-only operation of the call's media stream, it is not disruptive.

Monitoring of media on a conference call applies only to the hConfCallparameter, not to the individual participating calls.

This function is for TAPI version 2.0 and later.


Header tapi.h
Library coredll.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also