Exemplo n.º 1
0
        /// <summary>
        /// Commit Agent Dialog Complete Handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        internal void AgentHuntCompleteHandler(object sender, DialogCompletedEventArgs e)
        {
            Dictionary <string, object> output = e.Output;
            TryCommitAgentAsyncResult   ar;
            bool agentApproval          = output.ContainsKey("QaAgentOfferApproval") ? Convert.ToBoolean(output["QaAgentOfferApproval"]) : false;
            InstantMessagingCall imCall = output.ContainsKey("Call") ? output["Call"] as InstantMessagingCall : null;

            _dictionaryOfTryCommitAsyncResults.TryGetValue((Guid)output["InstanceId"], out ar);
            _dictionaryOfTryCommitAsyncResults.Remove((Guid)output["InstanceId"]);

            if (ar == null)
            {
                Debug.Assert(false, "failed to get TryCommitAgentAsyncResult");
            }

            if (agentApproval)
            {
                ar.SetAsCompleted(imCall, false);
            }

            else
            {
                if (null != imCall)
                {
                    imCall.BeginTerminate(ter => { imCall.EndTerminate(ter); }, null);
                    ar.SetAsCompleted(null, false);
                }
                else
                {
                    ar.SetAsCompleted(new OperationFailureException("AcdAgentHunter: DialogTerminated is getting hit"), false);
                }
            }
        }
Exemplo n.º 2
0
        private void EndTerminateCall(IAsyncResult ar)
        {
            InstantMessagingCall instantMessagingCall = ar.AsyncState as InstantMessagingCall;

            // End terminating the incoming call.
            instantMessagingCall.EndTerminate(ar);

            // Remove this event handler now that the call has been terminated.
            _instantMessagingCall.StateChanged -= InstantMessagingCall_StateChanged;

            //Again, just to sync the completion of the code.
            _autoResetEvent.Set();
        }
        // Callback method referred to in the call to BeginTerminate on the InstantMessagingCall instance.
        private void CallTerminateCB(IAsyncResult ar)
        {
            InstantMessagingCall instantMessagingCall = ar.AsyncState as InstantMessagingCall;

            // Finish the termination of the incoming call.
            instantMessagingCall.EndTerminate(ar);

            // The call has been terminated, so remove the handler for the StateChanged event.
            _instantMessagingCall.StateChanged -= InstantMessagingCall_StateChanged;

            // Terminate the conversation.
            _instantMessagingCall.Conversation.BeginTerminate(ConversationTerminateCB,
                                                              _instantMessagingCall.Conversation);
        }
        /// <summary>
        /// Im call establish completed callback method.
        /// </summary>
        /// <param name="asyncResult">Async result.</param>
        private void InstantMessagingCallTerminated(IAsyncResult asyncResult)
        {
            bool exceptionEncountered = true;

            try
            {
                InstantMessagingCall imCall = asyncResult.AsyncState as InstantMessagingCall;
                imCall.EndTerminate(asyncResult);

                //Now try to terminate av call.
                this.TerminateAudioVideoCall();

                exceptionEncountered = false;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    this.CompleteTerminateConversationOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
Exemplo n.º 5
0
        private void InstantMessagingCallTerminated(IAsyncResult ar)
        {
            InstantMessagingCall instantMessagingCall = ar.AsyncState as InstantMessagingCall;

            try
            {
                // End terminating the incoming call.
                instantMessagingCall.EndTerminate(ar);

                // Remove this event handler now that the call has been terminated.
                instantMessagingCall.StateChanged -= InstantMessagingCall_StateChanged;
                instantMessagingCall.InstantMessagingFlowConfigurationRequested -= this.InstantMessagingCall_FlowConfigurationRequested;
            }
            catch (Exception e)
            {
                NonBlockingConsole.WriteLine(e.ToString());
            }
            finally
            {
                //Again, just to sync the completion of the code.
                _waitForIMCallTerminated.Set();
            }
        }
Exemplo n.º 6
0
 private void TerminateIMCall(InstantMessagingCall imCall)
 {
     imCall.BeginTerminate(ar => { Logger.Log(Logger.LogLevel.Info, "IMCall terminated."); imCall.EndTerminate(ar); }, null);
 }