Opening Lines
After having obtained the capabilities of a line, an application must open the line device before it can access telephony functions on that line. (Because a line device is an abstraction of a line as defined by telephony, opening a line and opening a line device can be used interchangeably.) When a line device has been opened successfully, the application receives a handle for it. The application can then use that line to take incoming calls, make outgoing calls, or monitor call activities on the line for logging purposes.
To open a line device for any purpose—monitoring or control—the application calls the lineOpen function. (Later, when the application is finished with the line device, it can close it with lineClose.)
The lineOpen function can be invoked in one of two ways:
-
Specifying the line device. A specific line device is selected by means of its line-device identifier (the dwDeviceID parameter). The lineOpen request will open the specified line device. Applications interested in handling incoming calls typically use specific line devices because the application has been notified which line is carrying or is expected to carry the incoming call. When a line device has been opened successfully, the application is returned a handle representing the open line.
-
Specifying desired properties of any line device. The application can specify that it wants to use any line device that has certain properties. In this case, the application uses the value LINEMAPPER instead of a specific line-device identifier as a dwDeviceID parameter for lineOpen. The application also specifies which properties it needs on the call in parameters to lineOpen. The function opens any available line device that supports the specified call parameters. This attempt, of course, may fail. If successful, the caller can determine the line-device identifier by calling lineGetID, specifying the handle (lphLine) to the open line device returned by lineOpen.
An application that has successfully opened a line device can use it to make an outgoing call except when the line supports only incoming calls.