Calls expose several events that can be useful to an application. For example, the StateChangedevent is raised when the state of the call changes and the ConversationChangedevent is raised when a new conversation is derived from the current conversation. A call will be moved to a derived conversation either when the remote participant of the call is different from the conversation’s remote participant or when the escalation operation fails to escalate all the established calls in the conversation. In the latter case, the calls for which the escalation operation failed will be moved to a derived conversation. Applications can use Reasonto determine why the call was moved to a derived conversation.

Applications must register for any events of interest before a call is established.

The following code demonstrates registering an event handler for the StateChangedevent on an instant messaging call and implementing a simple event handler for this event.

Copy Code
imCall.StateChanged += IMCall_StateChanged;
private void IMCall_StateChanged(object sender,
StateChangedEventArgs<CallState> e)
{
}

The following code demonstrates registering an event handler for the StateChangedevent on an audio/video call and implementing a simple event handler for this event.

Copy Code
avCall.StateChanged += AVCall_StateChanged;
private void AVCall_StateChanged(object sender,
StateChangedEventArgs<CallState> e)
{
  // Code for handling the StateChanged event.
}