AddTapi.NET Developer's Manual
CallState Event
NamespacesTraysoft.AddTapiTapiAppCallState
Occurs when the state of a call has changed.
Declaration Syntax
C#Visual BasicVisual C++
public static event TapiEventHandler CallState
Public Shared Event CallState As TapiEventHandler
public:
static  event TapiEventHandler^ CallState {
	void add (TapiEventHandler^ value);
	void remove (TapiEventHandler^ value);
}
Remarks

This event is fired when a telephony service provider reports that the state of a call has changed. Use State property to obtain new state of the call.

CallState event can be fired before AddTapi.NET reports a new call using IncomingCall or OutgoingCall event. Most applications do not need to handle CallState event and should use IncomingCall, OutgoingCall, CallConnected and CallDisconnected events instead.

Note:
In Windows Forms and WPF applications AddTapi.NET executes the handler of this event on the main thread of the application (the thread that called Initialize(String)). It is safe to access Windows Forms or WPF controls from the event handler without using Invoke mechanism.
Examples
The following code shows how to handle CallState event.

C#

            TapiApp.Initialize("MyApp");
            TapiApp.CallState += OnCallState;
            ...
            
            void OnCallState(object sender, TapiEventArgs args)
            {
                TapiCallState callState = args.Call.State;
                // Display a message to the user
                Console.WriteLine("Call on line {0} transitioned to {1} state", args.Line.Name, callState);
            }
            

VB.NET

            TapiApp.Initialize("MyApp")
            AddHandler TapiApp.CallState, AddressOf OnCallState
            ...
            
            Private Sub OnCallState(ByVal sender As Object, ByVal args As TapiEventArgs)
                Dim callState As TapiCallState
                callState = args.Call.State
                ' Display a message to the user
                Console.WriteLine("Call on line {0} transitioned to {1} state", args.Line.Name, callState)
            End Sub
            

Assembly: Traysoft.AddTapi (Module: Traysoft.AddTapi)