2.4.1.1 Line SPI Initialization
As part of the using the line device abstraction defined by the TSPI, the TAPI DLL and Service Provider must first go through some basic initialization. The first of these steps is interface version negotiation. The TAPI 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 may operate according to different interface versions. The TAPI DLL passes a special reserved device ID value, INITIALIZE_NEGOTIATION, to indicate that it is negotiating an overall interface version for early initialization functions that affect all line devices.
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.
Another minor function that may be called early in initialization is TSPI_lineGetProcTable. This procedure retrieves pointers to all of the line-related procedures defined by the TSPI and implemented by the Service Provider. In principle, the TAPI DLL should load all of these procedure pointers by name using the usual library-management procedures supplied by Windows to do so. In fact, the Service Provider is required to EXPORT all of its entry point procedures to support such an approach. In practice, this may be a very slow operation, so TSPI_lineGetProcTable is supplied as an alternate optimization.
The next major step in initialization is TSPI_lineSetDeviceIDBase. Devices of the Telephony "line" device class are identified by integers starting from zero. This range of identifiers is contiguous across the full range of line devices. Since there may be multiple Service Providers managing line devices in a single system, each Service Provider gets a contiguous portion of the total range. The TSPI_lineSetDeviceIDBase function tells the Service Provider the lowest value in its portion of the range. The Service Provider, rather than the TAPI DLL, has the responsibility for mapping this variable range to its own internal device identifiers. This gives the Service Provider vendor sufficient flexibility to use device IDs in device-specific extensions if it so desires. Since the Service Provider "knows" what device IDs appear in the TAPI-defined parameters and data structures, it can use consistent device IDs in device-specific extension parameters and data structures.
TSPI_lineNegotiateTSPIVersion
Negotiates an interface version number for early-initialization functions that may be called before a line is opened.
TSPI_lineGetProcTable
Retrieves pointers to all the line-related procedures defined by the TSPI and implemented by the Service Provider.
TSPI_lineSetDeviceIDBase
Sets the base of the Service Provider's contiguous range of line device IDs.
All of these functions operate strictly asynchronously.