Friday, October 5, 2007

TAPI 2.x vs TAPI 3.x

It is a common misconception that TAPI 3.0 (or TAPI 3.1) replaces TAPI 2.x. TAPI 2.x (and all earlier versions) is written in C/C++ and requires applications to make heavy use of C style pointer arithmetic. This makes TAPI fast and easy to access from C/C++ applications, but it also makes it difficult to use from many other programming languages.

On the other hand, TAPI 3.x was designed with a COM (Component Object Model) interface. This was done with the intent of making it accessible from managed languages like Visual Basic, VBScript, Java or other environments that provide easy access to COM but don't deal with C-style pointers.

TAPI 3.x has a slightly different set of functionality than TAPI 2.x. The addition of integrated media control was the most significant addition. But TAPI 3.x doesn't include all functionality that TAPI 2.x does, like support for the Phone class.

One very notable issue with TAPI 3.x is the lack of support for managed code (.NET environment). As documented in Microsoft KB Article 841712, Microsoft currently has no plans to support TAPI 3.x directly from .Net programming languages. However, Mark Smith has provided a Managed C++ library called TSP++ 3.0.

One often overlooked reason an application developer might choose between TAPI 2.x and TAPI 3.x should be the hardware vendors recommendation. Even though TAPI provides an abstract model of phone lines, telephony applications are still heavily impacted by the specific behavior of the underlying hardware. Troubleshooting behavior issues usually requires both software and hardware vendors to collaborate. Because there is almost a 1:1 relationship between the TAPI Service Provider (TSP) interface and the TAPI 2.x interface, collaboration is often easier if the application is designed using TAPI 2.x. Experience with TAPI 3.x varies significantly between hardware vendors.

Telephony Application Programming Interface (TAPI) functionality is not supported from managed code:
This article discusses why Telephony Application Programming Interface (TAPI) is not supported from managed code. An alternative method permits you to call TAPI functionality from managed code.
***** Because of the complexity of the TAPI 3.x Component Object Model (COM) interface, the managed wrapper that is created by Microsoft Visual Studio .NET does not work. Therefore, you cannot call TAPI functionality from managed code.

Microsoft has no current plans to release a TAPI interoperative component.*****

Using TAPI from managed code
You can use different versions of TAPI in different programming environments.
TAPI 2.x
TAPI 2.x is an interface that is based on the C programming language.

You can call TAPI functionality from the Managed Extensions for C++ applications in Microsoft Visual Studio .NET by using TAPI 2.x (Tapi32.dll).

All the TAPI 2.x data structures are based on the DWORD data type. TAPI 2.x also requires heavy use of pointers. Therefore, TAPI 2.x functionality is difficult to use from any language other than the Managed Extensions for C++.
TAPI 3.x
TAPI 3.x is an interface that is based on Component Object Model (COM).

You can call TAPI 3.x (Tapi3.dll) functionality from unmanaged code. Create an unmanaged DLL that calls TAPI 3.x functionality, and then call the unmanaged DLL from managed code.

For more information, visit the following Microsoft Developer Network (MSDN) Web sites:
TAPI DLL
http://msdn2.microsoft.com/en-us/library/ms734236.aspx (http://msdn2.microsoft.com/en-us/library/ms734236.aspx)

TAPI 2.2 Overview
http://msdn2.microsoft.com/en-us/library/ms737218.aspx (http://msdn2.microsoft.com/en-us/library/ms737218.aspx)

TAPI 3.1 Overview
http://msdn2.microsoft.com/en-us/library/ms734214.aspx

No comments: