Occurs when the state of a call has changed.
| C# | Visual Basic | Visual 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); }
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.
| In Windows Forms application 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 controls from the event handler without using Invoke mechanism. |
The following code shows how to process 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)