lineOpen
A version of this page is also available for
4/8/2010
This function opens the line device specified by its device identifier and returns a line handle for the corresponding opened line device. This line handle is used in subsequent operations on the line device.
Syntax
LONG lineOpen(
HLINEAPP hLineApp,
DWORD dwDeviceID,
LPHLINE lphLine,
DWORD dwAPIVersion,
DWORD dwExtVersion,
DWORD dwCallbackInstance,
DWORD dwPrivileges,
DWORD dwMediaModes,
LPLINECALLPARAMS const lpCallParams
);
Parameters
- hLineApp
[in] Handle to the application's registration with TAPI.
- dwDeviceID
[in] Identifier of the line device to be opened. It must be a valid device identifier.
- lphLine
[out] Pointer to an HLINE handle that is then loaded with the handle representing the opened line device. Use this handle to identify the device when invoking other functions on the open line device.
- dwAPIVersion
[in] TAPI version number under which the application and TAPI have agreed to operate. This number is obtained with the lineNegotiateAPIVersion function.
- dwExtVersion
[in] Unsupported; set to zero.
- dwCallbackInstance
[in] User-instance data passed back to the application with each message associated with this line or with addresses or calls on this line. This parameter is not interpreted by TAPI.
dwPrivileges
[in] Privilege the application wants for the calls it is notified for. This parameter can be a combination of the LINECALLPRIVILEGE. The following table shows the values the parameter can take.Value Description LINECALLPRIVILEGE_NONE
The application can make only outgoing calls.
LINECALLPRIVILEGE_MONITOR
The application can monitor only incoming and outgoing calls.
LINECALLPRIVILEGE_OWNER
The application can own only incoming calls of the types specified in dwMediaModes.
LINECALLPRIVILEGE_MONITOR + LINECALLPRIVILEGE_OWNER
The application can own only incoming calls of the types specified in dwMediaModes, but if it is not an owner of a call, it is a monitor.
Other flag combinations are invalid.
- dwMediaModes
[in] Media mode or modes of interest to the application. This parameter is used to register the application as a potential target for incoming call and call handoff for the specified media mode. This parameter is meaningful only if the bit LINECALLPRIVILEGE_OWNER in dwPrivileges is set (and ignored if it is not). This parameter uses LINEMEDIAMODE.
- lpCallParams
[in] Pointer to a structure of type LINECALLPARAMS. This pointer should be set to NULL for Windows Embedded CE 2.x.
Return Value
Zero indicates success. A negative error number indicates that an error occurred. The following table shows the return values for this function.
Value | Description |
---|---|
LINEERR_ALLOCATED |
The line cannot be opened due to a persistent condition. |
LINEERR_BADDEVICEID |
The device id provided is incorrect. |
LINEERR_INCOMPATIBLEAPIVERSION |
The API version is incompatible |
LINEERR_INCOMPATIBLEEXTVERSION |
The extension version is incompatible. |
LINEERR_INVALAPPHANDLE |
The app handle is invalid. |
LINEERR_INVALMEDIAMODE |
The line device is opened with owner privilege and an extension media mode is not registered. |
LINEERR_INVALPOINTER |
The pointer is invalid. |
LINEERR_INVALPRIVSELECT |
The privilege selected is invalid. |
LINEERR_LINEMAPPERFAILED |
|
LINEERR_NODEVICE |
The device was not found. |
LINEERR_NODRIVER |
The driver was not found. |
LINEERR_NOMEM |
Not enough memory is available for this operation. |
LINEERR_OPERATIONFAILED |
The operation failed. |
LINEERR_OPERATIONUNAVAIL |
The operation is unavailable. |
LINEERR_REINIT |
The application attempted to initialize TAPI twice. |
LINEERR_RESOURCEUNAVAIL |
The line cannot be opened due to a dynamic resource overcommitment |
LINEERR_STRUCTURETOOSMALL |
The structure is too small. |
LINEERR_UNINITIALIZED |
A parameter is uninitialized. |
Remarks
If LINEERR_ALLOCATED is returned, the line cannot be opened due to a persistent condition, such as that of a serial port being exclusively opened by another process. If LINEERR_RESOURCEUNAVAIL is returned, the line cannot be opened due to a dynamic resource overcommitment such as in DSP processor cycles or memory. This overcommitment can be transitory, caused by monitoring of media mode or tones, and changes in these activities by other applications can make it possible to reopen the line within a short time period.
Opening a line always entitles the application to make calls on any address available on the line. The ability of the application to deal with incoming calls or to be the target of call handoffs on the line is determined by the dwMediaModes parameter. The lineOpen function registers the application as having an interest in monitoring calls or receiving ownership of calls that are of the specified media modes. If the application just wants to monitor calls, then it can specify LINECALLPRIVILEGE_MONITOR. If the application just wants to make outgoing calls, it can specify LINECALLPRIVILEGE_NONE. If the application is willing to control unclassified calls (calls of unknown media mode), it can specify LINECALLPRIVILEGE_OWNER and LINEMEDIAMODE_UNKNOWN. Otherwise, the application should specify the media mode it is interested in handling.
The media modes specified with lineOpen add to the default value for the provider's media mode monitoring for initial incoming call type determination. If a line device is opened with owner privilege and an extension media mode is not registered, then the error LINEERR_INVALMEDIAMODE is returned.
An application that has successfully opened a line device can initiate calls using the lineMakeCall function.
A single application can specify multiple flags simultaneously to handle multiple media modes. Conflicts can arise if multiple applications open the same line device for the same media mode. These conflicts are resolved by a priority scheme in which the user assigns relative priorities to the applications. Only the highest priority application for a given media mode will ever receive ownership (unsolicited) of a call of that media mode. Ownership can be received when an incoming call first arrives or when a call is handed off.
An application that handles automated voice should also select the interactive voice open mode and be assigned the lowest priority for interactive voice. The reason for this is that service providers report all voice media modes as interactive voice. If media mode determination is not performed by the application for the UNKNOWN media type, and no interactive voice application has opened the line device, voice calls would be unable to reach the automated voice application, and would be dropped.
The same application, or different installations of the same application, can open the same line multiple times with the same or different parameters.
When an application opens a line device it must specify the negotiated TAPI version, which is obtained with a call to the lineNegotiateAPIVersion function. Version numbering enables the mixing and matching of different application versions with different TAPI versions.
Requirements
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
Reference
lineGetID
lineInitialize
lineMakeCall
lineNegotiateAPIVersion
lineShutdown
LINECALLPARAMS