/// <summary> /// Callback for conference termination. /// </summary> /// <param name="asyncResult"></param> private void ConferenceTerminated(IAsyncResult asyncResult) { Exception caughtException = null; bool unhandledExceptionOccured = true; try { ConferenceSession confSession = asyncResult.AsyncState as ConferenceSession; confSession.EndTerminateConference(asyncResult); this.trustedConversation.BeginTerminate(this.ConversationTerminationCompleted, this.trustedConversation); unhandledExceptionOccured = false; } catch (InvalidOperationException ioe) { caughtException = ioe; Console.WriteLine("Exception during termination {0}", ioe); this.logger.Log("Exception during termination {0}", ioe); unhandledExceptionOccured = false; } catch (RealTimeException rte) { caughtException = rte; Console.WriteLine("Exception during termination {0}", rte); this.logger.Log("Exception during termination {0}", rte); unhandledExceptionOccured = false; } finally { if (unhandledExceptionOccured) { caughtException = new OperationFailureException(); Console.WriteLine("Unhandled Exception during termination"); this.logger.Log("Unhandled Exception during termination"); } if (caughtException != null) { this.CompleteTermination(); } } }
internal void Process() { if (_anchor._conversation.State != ConversationState.Idle) { if (null != _anchor._conference) { _anchor._conversation.ConferenceSession.BeginTerminateConference(ar => { ConferenceSession confSession = ar.AsyncState as ConferenceSession; confSession.EndTerminateConference(ar); confSession.Conversation.Endpoint.ConferenceServices.BeginCancelConference(_anchor._conference.ConferenceId, cac => { ConferenceServices confServices = cac.AsyncState as ConferenceServices; try { confServices.EndCancelConference(cac); } catch (RealTimeException) { //TODO: trace statement } finally { this.SetAsCompleted(null, false); _anchor.UpdateState(ConferenceServicesAnchorState.Terminated); foreach (ShutDownAsyncResult sar in _anchor._listOfShutDownAsyncResults) { sar.SetAsCompleted(null, false); } } }, confSession.Conversation.Endpoint.ConferenceServices); }, _anchor._conversation.ConferenceSession); } else { _anchor.Conversation.BeginTerminate(ter => { _anchor.Conversation.EndTerminate(ter); _anchor.UpdateState(ConferenceServicesAnchorState.Terminated); foreach (ShutDownAsyncResult sar in _anchor._listOfShutDownAsyncResults) { sar.SetAsCompleted(null, false); } this.SetAsCompleted(null, false); }, null); } } else { _anchor.Conversation.BeginTerminate(ter => { _anchor.Conversation.EndTerminate(ter); _anchor.UpdateState(ConferenceServicesAnchorState.Terminated); foreach (ShutDownAsyncResult sar in _anchor._listOfShutDownAsyncResults) { sar.SetAsCompleted(null, false); } this.SetAsCompleted(null, false); }, null); } }