Click or drag to resize
Getting Started

Before you can use AddTapi.NET or any other TAPI-compatible software, you have to install and configure TAPI driver (also called Telephony Service Provider or TSP) for your telephony board or phone system. Windows has built-in Unimodem TSP for regular dial-up modems. For all other telephony hardware you will need to install and configure a TSP provided by the hardware manufacturer. Please refer to the manual for your telephony board or phone system for more information. Please contact us if you have any questions about TAPI drivers and we will be happy to help.

After TAPI driver (TSP) is installed and configured, you can try one of the samples included with AddTapi.NET. If TAPI driver is working properly, you should see available lines/extensions in the line selection box in the samples.

Using AddTapi.NET in your C# or VB.NET application

1. Add a reference to Traysoft.AddTapi.dll located in AddTapi installation folder to your project. If your application targets .NET 6.0+, please reference Traysoft.AddTapi.dll located in the net6.0 folder of your AddTapi installation. If your application targets .NET 2.0 or 3.x, please reference Traysoft.AddTapi.dll located in the NET2 folder.

2. When the application loads, initialize AddTapi by calling Initialize(String). TAPI initialization is resource-intensive, so you should initialize AddTapi only once when the application loads and shut it down by calling Shutdown before the application terminates.

After initializing AddTapi, the application should subscribe to events it is interesting in. For example, a simple caller id application would subscribe to the IncomingCall event.

3. After AddTapi is initialized, the Lines collection contains a list of available lines that the application can use. Each TAPI line (TapiLine object) represents a physical line or a phone extension that can receive calls and place outgoing calls.

Open the line(s) that your application needs to monitor. The application should call Open(Boolean, TapiCallHandler) with the first argument set to true if the application wants to receive any call-related events from that line, such as IncomingCall, OutgoingCall, CallConnected and CallDisconnected events. If the application just needs to make outgoing calls on the line and is not interested in call-related events, first argument of Open(Boolean, TapiCallHandler) can be set to false. Dial(String, Boolean) can be used to make outgoing calls in any case.

using Traysoft.AddTapi;
...
TapiApp.Initialize("MyApp");
TapiApp.IncomingCall += OnIncomingCall;
foreach (TapiLine line in TapiApp.Lines)
{
    // Show available lines to the user and allow to select the line(s) to monitor
    // line.Name contains user-friendly line name
    // In this example we open all available lines
    line.Open(true, null);
}
...
// This event handler is called when a new incoming call is received.
void OnIncomingCall(object sender, TapiEventArgs args)
{
    // Show call information to the user
    // args.Line contains TapiLine that received the call
    // args.Call contains TapiCall object with information about the call
    Console.WriteLine("Call from {0} on line {1}", args.Call.CallerID, args.Line.Name);
}
Caution note Caution

The simplified code above does not handle any AddTapi errors. Please refer to AddTapi.NET samples for the full sample code with error handling.