Line Initialization
As part of the line device abstraction defined by TSPI, tapi32.dll and the service provider must first perform some basic initialization. The first step is interface version negotiation. The tapi32.dll performs this by calling the TSPI_lineNegotiateTSPIVersion function. This function is usually used to negotiate on behalf of an individual line device; different line devices within the same service provider can operate under different interface versions. The tapi32.dll passes a special reserved device identifier value, INITIALIZE_NEGOTIATION, to indicate that it is negotiating an overall interface version for initialization functions that affect the entire service provider.
The result of this negotiation is passed to subsequent procedures until a line device is opened. At that time, the line device becomes committed to a particular interface version. This interface version is implicit until the line is closed, and does not need to be passed to subsequent functions that operate on an opened line or calls on the line.
Following overall interface version negotiation, tapi32.dll calls the TSPI_providerInit function. This function initializes the service provider, and gives it parameters required for subsequent operation. These parameters include the following:
-
dwPermanentProviderID Specifies the permanent identifier, unique within the service providers on this system, of the service provider being initialized.
-
dwLineDeviceIDBase Specifies the lowest device identifier for the line devices supported by this service provider. Devices of the telephony line device class are identified by integers starting at zero. This range of identifiers is contiguous across the full range of line devices. Because there can be multiple service providers managing line devices in a single system, each service provider obtains a contiguous portion of the total range. This parameter tells the service provider the lowest value in its portion of the range. The service provider, rather than tapi32.dll, is responsible for mapping this variable range to its own internal device identifiers. This gives the service-provider vendor sufficient flexibility to use device identifiers in device-specific extensions if it wants. Because the service provider knows what device identifiers appear in the TAPI-defined parameters and data structures, it can use consistent device identifiers in device-specific extension parameters and data structures.
-
dwPhoneDeviceIDBase Specifies the lowest device identifier for the phone devices supported by this service provider.
-
dwNumLines Specifies the number of line devices that this service provider supports.
-
dwNumPhones Specifies the number of phone devices that this service provider supports.
-
lpfnCompletionProc Specifies the procedure the service provider calls to report completion of all asynchronously operating procedures on line and phone devices.
Following TSPI_providerInit, normal operations such as opening lines can be performed.