Applications can terminate a conversation using the BeginTerminatemethod. Although the platform can terminate a conversation (indicated by the StateChangedevent), the best practice is for the application to terminate a conversation. If an application terminates an endpoint, all calls, conference invitations and the conference session are automatically terminated.

The following code example demonstrates terminating an existing conversation.

Copy Code
Conversation conversation = new Conversation(endpoint);
…
conversation.BeginTerminate(Conversation_TerminateCompleted,
conversation);

void Conversation_TerminateCompleted(IAsyncResult asyncResult)
{
	Conversation conversation = asyncResult.AsyncState as
Conversation;
	conversation.EndTerminate(asyncResult); // Should not throw.
}
Note:
Although a ConferenceSessioncan be terminated directly, the best practice is instead to terminate the Conversation, as shown in the previous code example.