Example #1
0
        public IAsyncResult BeginStartMonitoringSession(Uri uri,
                                                        AsyncCallback userCallback, object state)
        {
            requestType request = _requestProcessor.CreateRequest(ContextChannelRequestType.StartMonitoring);

            request.startmonitoringsession = new startmonitoringsessionType
            {
                uri       = uri.ToString(),
                sessionId = Guid.NewGuid().ToString()
            };


            SupervisorMonitoringChannel monitoringChannel = new SupervisorMonitoringChannel(this, request.startmonitoringsession.sessionId);

            _monitoringChannel = monitoringChannel;

            ProcessRequestAsyncResult requestAsyncResult =
                new StartMonitoringProcessRequestAsyncResult(monitoringChannel, request, _requestProcessor,
                                                             userCallback, state);

            _requestProcessor.AddPendingRequest(request, requestAsyncResult);

            requestAsyncResult.Process();


            return(requestAsyncResult);
        }
Example #2
0
        public IAsyncResult BeginStopMonitoringSession(
            AsyncCallback userCallback, object state)
        {
            SupervisorMonitoringChannel monitoringChannel = _monitoringChannel;

            if (monitoringChannel == null)
            {
                AsyncResultNoResult result = new AsyncResultNoResult(userCallback, state);
                result.SetAsCompleted(null, true);
                return(result);
            }
            _monitoringChannel = null;

            requestType request = _requestProcessor.CreateRequest(ContextChannelRequestType.StopMonitoring);

            request.terminatemonitoringsession           = new terminatemonitoringsessionType();
            request.terminatemonitoringsession.sessionId = monitoringChannel.SessionId;

            ProcessRequestAsyncResult requestAsyncResult =
                new ProcessRequestAsyncResult(request, _requestProcessor, Conversation, ApplicationId,
                                              userCallback, state);

            _requestProcessor.AddPendingRequest(request, requestAsyncResult);

            requestAsyncResult.Process();


            return(requestAsyncResult);
        }
 public StartMonitoringProcessRequestAsyncResult(SupervisorMonitoringChannel monitoringChannel,
                                                 requestType request,
                                                 RequestProcessor requestProcessor,
                                                 AsyncCallback userCallback, object state)
     : base(request, requestProcessor, monitoringChannel.SupervisorDashboardChannel.Conversation,
            monitoringChannel.SupervisorDashboardChannel.ApplicationId, userCallback, state)
 {
     SupervisorMonitoringChannel = monitoringChannel;
 }
Example #4
0
 public ProcessRequestAsyncResult(requestType request,
                                  RequestProcessor requestProcessor,
                                  Conversation conversation,
                                  string applicationId,
                                  AsyncCallback userCallback, object state)
     : base(userCallback, state)
 {
     Request           = request;
     _requestProcessor = requestProcessor;
     Conversation      = conversation;
     ApplicationId     = applicationId;
 }
Example #5
0
        public IAsyncResult BeginHold(AsyncCallback userCallback, object state)
        {
            requestType request = _requestProcessor.CreateRequest(ContextChannelRequestType.Hold);

            ProcessRequestAsyncResult requestAsyncResult =
                new ProcessRequestAsyncResult(request, _requestProcessor, Conversation, ApplicationId,
                                              userCallback, state);

            _requestProcessor.AddPendingRequest(request, requestAsyncResult);

            requestAsyncResult.Process();


            return(requestAsyncResult);
        }
        public IAsyncResult BeginBargeIn(
            AsyncCallback userCallback, object state)
        {
            requestType request = _requestProcessor.CreateRequest(ContextChannelRequestType.BargeIn);


            ProcessRequestAsyncResult requestAsyncResult =
                new ProcessRequestAsyncResult(request, _requestProcessor, SupervisorDashboardChannel.Conversation, SupervisorDashboardChannel.ApplicationId,
                userCallback, state);

            _requestProcessor.AddPendingRequest(request, requestAsyncResult);

            requestAsyncResult.Process();


            return requestAsyncResult;
        }
        public IAsyncResult BeginWhisper(Uri uri,
            AsyncCallback userCallback, object state)
        {
            requestType request = _requestProcessor.CreateRequest(ContextChannelRequestType.Whisper);

            request.whisper = new whisperType();
            request.whisper.uri = uri.ToString();

            ProcessRequestAsyncResult requestAsyncResult =
                new ProcessRequestAsyncResult(request, _requestProcessor, SupervisorDashboardChannel.Conversation, SupervisorDashboardChannel.ApplicationId,
                userCallback, state);

            _requestProcessor.AddPendingRequest(request, requestAsyncResult);

            requestAsyncResult.Process();


            return requestAsyncResult;
        }
Example #8
0
        public IAsyncResult BeginEscalate(IEnumerable <agentSkillType> skills,
                                          AsyncCallback userCallback, object state)
        {
            requestType request = _requestProcessor.CreateRequest(ContextChannelRequestType.Escalate);

            request.escalate             = new escalateType();
            request.escalate.agentSkills = skills.ToArray();

            ProcessRequestAsyncResult requestAsyncResult =
                new ProcessRequestAsyncResult(request, _requestProcessor, Conversation, ApplicationId,
                                              userCallback, state);

            _requestProcessor.AddPendingRequest(request, requestAsyncResult);

            requestAsyncResult.Process();


            return(requestAsyncResult);
        }
Example #9
0
        public static string Serialize(requestType request)
        {
            string serializedRequest;

            using (StringWriter sw = new StringWriter(new StringBuilder(128), CultureInfo.InvariantCulture))
            {
                using (XmlWriter messageWriter = XmlWriter.Create(sw))
                {
                    messageWriter.WriteStartElement("request");

                    messageWriter.WriteStartAttribute("requestId");
                    messageWriter.WriteString(request.requestId.ToString());
                    messageWriter.WriteEndAttribute();

                    if (!string.IsNullOrEmpty(request.sessionId))
                    {
                        messageWriter.WriteStartAttribute("sessionId");
                        messageWriter.WriteString(request.sessionId);
                        messageWriter.WriteEndAttribute();
                    }
                    if (request.hold != null)
                    {
                        messageWriter.WriteStartElement("hold");
                        messageWriter.WriteEndElement();
                    }
                    else if (request.retrieve != null)
                    {
                        messageWriter.WriteStartElement("retrieve");
                        messageWriter.WriteEndElement();
                    }
                    else if (request.bargein != null)
                    {
                        messageWriter.WriteStartElement("bargein");
                        messageWriter.WriteEndElement();
                    }
                    else if (request.whisper != null)
                    {
                        messageWriter.WriteStartElement("whisper");
                        messageWriter.WriteStartElement("uri");
                        messageWriter.WriteString(request.whisper.uri);
                        messageWriter.WriteEndElement();

                        messageWriter.WriteEndElement();
                    }
                    else if (request.escalate != null)
                    {
                        messageWriter.WriteStartElement("escalate");
                        messageWriter.WriteStartElement("agentSkills");

                        foreach (agentSkillType skill in request.escalate.agentSkills)
                        {
                            messageWriter.WriteStartElement("agentSkill");

                            messageWriter.WriteStartAttribute("name");
                            messageWriter.WriteString(skill.name);
                            messageWriter.WriteEndAttribute();

                            messageWriter.WriteString(skill.Value);

                            messageWriter.WriteEndElement();
                        }

                        messageWriter.WriteEndElement();
                        messageWriter.WriteEndElement();
                    }
                    else if (request.startmonitoringsession != null)
                    {
                        messageWriter.WriteStartElement("start-monitoring-session");

                        messageWriter.WriteStartAttribute("sessionId");
                        messageWriter.WriteString(request.startmonitoringsession.sessionId);
                        messageWriter.WriteEndAttribute();

                        messageWriter.WriteStartElement("uri");
                        messageWriter.WriteString(request.startmonitoringsession.uri);
                        messageWriter.WriteEndElement();

                        messageWriter.WriteEndElement();
                    }
                    else if (request.terminatemonitoringsession != null)
                    {
                        messageWriter.WriteStartElement("terminate-monitoring-session");

                        messageWriter.WriteStartAttribute("sessionId");
                        messageWriter.WriteString(request.terminatemonitoringsession.sessionId);
                        messageWriter.WriteEndAttribute();

                        messageWriter.WriteEndElement();
                    }

                    messageWriter.WriteEndElement(); //end request

                    messageWriter.Close();

                    serializedRequest = sw.ToString();
                }
            }

            return(serializedRequest);
        }