Share via


Registering for Call Events

Calls expose several events that can be useful to an application. For example, the StateChanged event is raised when the state of the call changes and the ConversationChanged event is raised when a call is moved to 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 Reason to 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 StateChanged event on an instant messaging call and implementing a simple event handler for this event.

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

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

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