// Callback for BeginTerminate on a call. private void TerminateCallCB(IAsyncResult ar) { AudioVideoCall audioVideoCall = ar.AsyncState as AudioVideoCall; // Finish terminating the call. audioVideoCall.EndTerminate(ar); }
private void EndTerminateCall(IAsyncResult ar) { AudioVideoCall audioVideoCall = ar.AsyncState as AudioVideoCall; // End terminating the incoming call. audioVideoCall.EndTerminate(ar); //Again, just to sync the completion of the code. _waitForCallToTerminate.Set(); }
// Callback referenced in the BeginTerminate method on the call. private void CallTerminateCB(IAsyncResult ar) { AudioVideoCall AVCall = ar.AsyncState as AudioVideoCall; // Complete the termination of the incoming call. AVCall.EndTerminate(ar); // Terminate the conversation. IAsyncResult result = _audioVideoCall.Conversation.BeginTerminate(ConversationTerminateCB, _audioVideoCall.Conversation); Console.WriteLine("Waiting for the conversation to be terminated..."); }
private void CallTerminateCB(IAsyncResult ar) { AudioVideoCall audioVideoCall = ar.AsyncState as AudioVideoCall; // Finish terminating the incoming call. audioVideoCall.EndTerminate(ar); // Unregister this event handler now that the call has been terminated. _audioVideoCall.StateChanged -= AudioVideoCall_StateChanged; // Terminate the conversation. _audioVideoCall.Conversation.BeginTerminate(ConversationTerminateCB, _audioVideoCall.Conversation); }
private void TerminateCall() { this.logger.Log("Call terminating for user {0}", audioVideoCall.OriginalDestinationUri); try { audioVideoCall.EndTerminate( audioVideoCall.BeginTerminate(result => { }, null) ); } catch { } }
/// <summary> /// Method to clean up callback call. /// </summary> private void CleanupCallbackCallIfNeeded() { //In exception cases terminate temporary callback av call. AudioVideoCall callbackCall = m_callbackCall; if (callbackCall != null) { callbackCall.BeginTerminate( delegate(IAsyncResult result) { callbackCall.EndTerminate(result); }, callbackCall); } }
/// <summary> /// Clean-up the call's EventHandlers /// </summary> private void CleanupCall() { lock (callCleanupLock) { if (currentCall != null) { if (currentCall.Flow != null) { currentCall.Flow.StateChanged -= new EventHandler <MediaFlowStateChangedEventArgs>(Flow_StateChanged); } currentCall.StateChanged -= new EventHandler <CallStateChangedEventArgs>(HandleCallStateChanged); currentCall.AudioVideoFlowConfigurationRequested -= new EventHandler <AudioVideoFlowConfigurationRequestedEventArgs>(Call_AudioVideoFlowConfigurationRequested); if (currentCall.State == CallState.Established) { currentCall.EndTerminate(currentCall.BeginTerminate(null, null)); } currentCall = null; } } }
private void AudioVideoCallTerminated(IAsyncResult ar) { AudioVideoCall audioVideoCall = ar.AsyncState as AudioVideoCall; try { // End terminating the incoming call. audioVideoCall.EndTerminate(ar); // audioVideoCall.AudioVideoFlowConfigurationRequested -= this.AudioVideoCall_FlowConfigurationRequested; // audioVideoCall.StateChanged -= this.AudioVideoCall_StateChanged; } catch (Exception e) { NonBlockingConsole.WriteLine("Error terminating AV call: " + e.ToString()); // TODO: Error message } finally { //Again, just to sync the completion of the code. _waitForAudioVideoCallTerminated.Set(); } }
/// <summary> /// Terminates the service channel. /// </summary> /// <param name="task">The task for this operation.</param> private void TerminateServiceChannelCall(AsyncTask task, object state) { Exception exception = null; try { Logger.Log(Logger.LogLevel.Info, "Terminating service channel call."); m_serviceChannelCall.BeginTerminate( ar => { Exception ex = null; try { m_serviceChannelCall.EndTerminate(ar); Logger.Log(Logger.LogLevel.Info, "Terminated service channel call."); } catch (RealTimeException rte) { ex = rte; } finally { task.Complete(ex); } }, null); } catch (InvalidOperationException ioe) { exception = ioe; } finally { if (exception != null) { task.Complete(exception); } } }
/// <summary> /// Av call establish completed callback method. /// </summary> /// <param name="asyncResult">Async result.</param> private void AudioVideoCallTerminated(IAsyncResult asyncResult) { bool exceptionEncountered = true; try { AudioVideoCall avCall = asyncResult.AsyncState as AudioVideoCall; avCall.EndTerminate(asyncResult); //Now try to terminate b2bcall. this.TerminateBackToBackCall(); exceptionEncountered = false; } finally { if (exceptionEncountered) { OperationFault operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/); this.CompleteTerminateConversationOperationWithException(new FaultException <OperationFault>(operationFault)); } } }