Click or drag to resize
TapiCallHandler Delegate
Represents a method that will perform call flow processing.

Namespace: Traysoft.AddTapi
Assembly: Traysoft.AddTapi (in Traysoft.AddTapi.dll) Version: 6.0.0.1110
Syntax
public delegate void TapiCallHandler(
	TapiCall call
)

Parameters

call
Type: Traysoft.AddTapiTapiCall
A call to be processed.
Remarks
When a call is connected, AddTapi.NET calls a method that will perform application-specific call flow processing. For an example of such methods please refer to the samples included in AddTapi.NET installation. Please note that your method must call Disconnect to release the call before the method exits if the call is no longer needed and should be disconnected. The method represented by this delegate is called on a separate thread and executed in the background. Several copies of this method can be executed at the same time (one for each line). If you call other methods of your class or access other classes, make sure you do that in a thread-safe manner. Windows Forms controls cannot be accessed directly in this method because it is called on a non-UI thread. The application must use Invoke mechanism to access Windows Forms controls from this method. Please refer to the included samples for an example of using Invoke to update Windows Forms controls.
Examples
The following code shows how to define a method for call flow processing. Error handling has been omitted for clarity.
TapiApp.Initialize("MyApp");
TapiLine line = TapiApp.Lines[0];
line.Open(true, CallHandler);
line.RingsToAnswer = 1;
...

// This method will be called when incoming call is answered
private void CallHandler(TapiCall call)
{
    call.Play("welcome.wav");
    call.Speak("Press 1 to hear the current time. Press any other button to disconnect.");
    if(call.WaitForDigit(20) == "1")
    {
        call.Speak(DateTime.Now.ToString());
        call.WaitUntilDone(10);
    }
    call.Disconnect();
}
See Also