Esempio n. 1
0
        /// <summary>
        /// Clear the Incident's ReservedAgent and Disable Agent not taking the call
        /// </summary>
        /// <param name="dtAllPoolAgents"></param>
        /// <returns></returns>
        protected bool checkReservations(PoolDS.PoolDSDataTable dtAllPoolAgents)
        {
            bool result = false;

            PoolDS.PoolDSRow[] rows = (PoolDS.PoolDSRow[])dtAllPoolAgents.Select("is_available=1 and is_busy=0", "");
            if (rows.Length > 0)
            {
                int cancelInterval = UcConfParameters.UcCallForwardingInterval;     // seconds


                foreach (PoolDS.PoolDSRow row in dtAllPoolAgents.Rows)
                {
                    if ((!row.Isincident_idNull()) && (!row.Isdate_reservedNull()))
                    {
                        DateTime now  = DateTime.Now.ToUniversalTime();
                        TimeSpan span = now.Subtract(row.date_reserved);
                        TimeSpan max  = new TimeSpan(0, 0, cancelInterval);

                        if (TimeSpan.Compare(span, max) > 0)
                        {
                            Int32 incidentId = row.incident_id;

                            Int32 incidentStatusId = 0;
                            Int32 incidentAgentId  = 0;

                            IncidentDS.IncidentDSDataTable dtIncident = BllProxyIncident.SelectIncident(incidentId);
                            if (dtIncident.Rows.Count > 0)
                            {
                                incidentStatusId = dtIncident[0].status_id;
                                if (!dtIncident[0].Isagent_idNull())
                                {
                                    incidentAgentId = dtIncident[0].agent_id;
                                }
                            }



                            if (incidentAgentId == 0)
                            {
                                if (incidentStatusId == 1)
                                {
                                    BllProxyIncidentHelper.SetIncidentReservation(incidentId, 0);
                                    BllProxyPool.SetPoolAgentAvailable(row.agent_id, false);
                                    BllProxyPool.SetPoolAgentBusy(row.agent_id, false);
                                }
                                else
                                {
                                    BllProxyPool.SetPoolAgentAvailable(row.agent_id, true);
                                    BllProxyPool.SetPoolAgentBusy(row.agent_id, true);
                                }
                            }

                            result = true;
                        }
                    }
                }
            }

            return(result);
        }
        protected void selectScreenCast()
        {
            //4:Screen cast

            Guid   guid      = new Guid();
            string agentName = "";

            IncidentDS.IncidentDSDataTable dt = BllProxyIncident.SelectIncident(profileId);
            if (dt.Rows.Count != 0)
            {
                guid      = dt[0].incident_guid;
                agentName = dt[0].agent_full_name;
            }

            String conferenceName = guid.ToString();


            ConferenceStartupParameters parameters = ConferenceHelper.GetParametersForScreenCast(conferenceName, agentName, true);


            //parameters.ShouldCreateConference = false;
            //parameters.ShouldStartAppShare = false;
            //parameters.UseJavascript = false;

            //string tempConferenceName = Convert.ToString(1000000 + profileId);
            //parameters.ConferenceName = tempConferenceName;


            IncidentHelper.SetIncidentStateScreenCast(profileId);
        }
        protected void selectConference()
        {
            //case 3: // Video session

            Guid   sessionGUID = new Guid();
            string agentName   = "";

            IncidentDS.IncidentDSDataTable dt = BllProxyIncident.SelectIncident(profileId);
            if (dt.Rows.Count != 0)
            {
                sessionGUID = dt[0].incident_guid;
                agentName   = dt[0].agent_full_name;
            }



            String conferenceName = sessionGUID.ToString();


            ConferenceStartupParameters parameters = ConferenceHelper.GetParametersForMultiVideo(conferenceName, "USER");


            string tempConferenceName = Convert.ToString(1000000 + profileId);

            parameters.ConferenceName = tempConferenceName;
            //VideoChatControl.Parameters = parameters;

            IncidentHelper.SetIncidentStateVideoSession(profileId);
        }
Esempio n. 4
0
        /// <summary>
        /// Disable the Agent if not online (Agent in AgentPool is not renewed for too long)
        /// Remove the Agent from AgentPool if not online for a week
        /// </summary>
        /// <param name="dtAllPoolAgents"></param>
        /// <returns></returns>
        protected bool cleanUp(PoolDS.PoolDSDataTable dtAllPoolAgents)
        {
            bool result = false;

            int cleanUpInterval = UcConfParameters.UcCallCleanUpInterval;

            foreach (PoolDS.PoolDSRow row in dtAllPoolAgents.Rows)
            {
                Int32 agentId = row.agent_id;


                DateTime now  = DateTime.Now.ToUniversalTime();
                TimeSpan span = now.Subtract(row.date_accessed);
                TimeSpan max;

                if (row.is_available)
                {
                    // Disable the Agent if not online (Agent in AgentPool is not renewed for too long)
                    max = new TimeSpan(0, 0, cleanUpInterval);             // seconds
                    if (TimeSpan.Compare(span, max) > 0)
                    {
                        BllProxyPool.SetPoolAgentAvailable(agentId, false);
                        result = true;
                    }



                    // Clean up the Agent's Incident and turn Agent available if the Incident is gone
                    if (!row.Isincident_idNull())
                    {
                        IncidentDS.IncidentDSDataTable dtIncident = BllProxyIncident.SelectIncident(row.incident_id);
                        if (dtIncident.Rows.Count > 0)
                        {
                            //if ((dtIncident[0].status_id != 1) || (dtIncident[0].agent_id != agentId))
                            if ((dtIncident[0].status_id != 1) || ((!dtIncident[0].Isagent_idNull()) && (dtIncident[0].agent_id != agentId)))
                            {
                                BllProxyPool.SetPoolAgentIncident(agentId, 0);
                                BllProxyPool.SetPoolAgentBusy(agentId, false);

                                result = true;
                            }
                        }
                    }
                }
                else
                {
                    // Remove the Agent from AgentPool if not online for a week

                    max = new TimeSpan(7, 0, 0, 0);                        // 7 days
                    if (TimeSpan.Compare(span, max) > 0)
                    {
                        BllProxyPool.DeletePoolAgent(agentId);
                        result = true;
                    }
                }
            }

            return(result);
        }
        protected void selectTextChat()
        {
            //2:Text Chat


            string agentName      = "";
            string conferenceName = "";

            IncidentDS.IncidentDSDataTable dt = BllProxyIncident.SelectIncident(profileId);
            if (dt.Rows.Count != 0)
            {
                conferenceName = dt[0].incident_guid.ToString();
                agentName      = dt[0].agent_full_name;
            }


            if (this.UcPage.UserRoleId != 2)   // Agent
            {
                UserDS.UserDSDataTable dtU = BllProxyUser.SelectUser(this.UcPage.UserId);
                if (dtU.Rows.Count != 0)
                {
                    string userRoleTitle = "";


                    switch (this.UcPage.UserRoleId)
                    {
                    case 1:     // Administrator
                        userRoleTitle = "ADMN";
                        break;

                    case 2:     // Agent
                        userRoleTitle = "AGNT";
                        break;

                    case 3:     // Manager
                        userRoleTitle = "MNGR";
                        break;

                    case 4:     // User
                        userRoleTitle = "USER";
                        break;

                    case 5:     // Supervisor
                        userRoleTitle = "SPVR";
                        break;
                    }


                    agentName = dtU[0].full_name + " [" + userRoleTitle + "]";
                }
            }


            TextChatControl.ConfSessionId   = conferenceName;
            TextChatControl.ConfSessionUser = agentName;


            IncidentHelper.SetIncidentStateTextChat(profileId);
        }
        protected void selectTransfer()
        {
            //6:Transfer

            IncidentDS.IncidentDSDataTable dt = BllProxyIncident.SelectIncident(profileId);
            if (dt.Rows.Count != 0)
            {
                statusId = dt[0].status_id;
            }

            TransferIncident.IncidentId = this.profileId;
            TransferIncident.StatusId   = this.statusId;
            IncidentHelper.SetIncidentStateActive(profileId);
        }
        protected void showVideo(Int32 incidentId)
        {
            Guid   guid      = new Guid();
            string agentName = "";

            IncidentDS.IncidentDSDataTable dt = BllProxyIncident.SelectIncident(incidentId);
            if (dt.Rows.Count != 0)
            {
                guid      = dt[0].incident_guid;
                agentName = dt[0].agent_full_name;
            }

            String conferenceName = guid.ToString();

            ((UcMasterPage)this.Master).ShowVideoChat(incidentId, conferenceName, agentName, "Agent");
            uctxControls.ShowVideoChat(incidentId, conferenceName, agentName, "Agent");
        }
        protected void showVideo(Int32 incidentId)
        {
            Guid   guid      = new Guid();
            string agentName = "";

            IncidentDS.IncidentDSDataTable dt = BllProxyIncident.SelectIncident(incidentId);
            if (dt.Rows.Count != 0)
            {
                guid      = dt[0].incident_guid;
                agentName = dt[0].agent_full_name;
            }



            String conferenceName = guid.ToString();



            //ConferenceStartupParameters parameters = new ConferenceStartupParameters();
            //parameters.VideoTransmitterMode = true;
            //parameters.VideoReceiverMode = false;
            //parameters.UseJavascript = true;
            //parameters.VideoWidth = 640;
            //parameters.VideoHeight = 480;
            //parameters.VideoFPS = 20;
            //parameters.VideoBandwidth = 56000;
            //parameters.VideoQuality = 80;
            //parameters.ScreenVideoWidth = 100;
            //parameters.ScreenVideoHeight = 100;
            //parameters.ConferenceName = conferenceName;
            //parameters.UserType = "Coach";
            //parameters.UserName = agentName;
            //parameters.ShouldCreateConference = true;
            //parameters.ShouldStartAppShare = true;
            //==========================================================================


            //ConferenceStartupParameters parameters = ConferenceHelper.GetParametersForTransmitter(conferenceName, agentName);

            //==========================================================================
            //((UcMasterPage)this.Master).ShowVideoChat(parameters);
            ((UcMasterPage)this.Master).ShowVideoChat(incidentId, conferenceName, agentName, "Agent");
            uctxControls.ShowVideoChat(incidentId, conferenceName, agentName, "Agent");
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            object obj = Request.QueryString["id"];

            if (obj != null)
            {
                Int32 i = 0;
                if (Int32.TryParse(obj.ToString(), out i))
                {
                    this.incidentId = i;
                }
            }


            if (this.incidentId != 0)
            {
                string agentName      = "";
                string facilityName   = "";
                string conferenceName = "";

                IncidentDS.IncidentDSDataTable dt = BllProxyIncident.SelectIncident(incidentId);
                if (dt.Rows.Count != 0)
                {
                    conferenceName = dt[0].incident_guid.ToString();
                    facilityName   = dt[0].facility_name;
                    agentName      = dt[0].agent_full_name;
                }

                ConferenceStartupParameters parameters = ConferenceHelper.GetParametersForReceiver(conferenceName, agentName, facilityName);

                //ConfVideo.Parameters = parameters;
            }
            else
            {
                //BllProxyIncidentHelper.SetIncidentStatus(this.incidentId, 4);   // 4:Closed
                Response.Redirect("default.aspx");
            }
        }
Esempio n. 10
0
        public void Start()
        {
            ltTimeSpan.Text   = "";
            lblAgentName.Text = "";

            pnlDisconnect.Visible        = true;
            pnlDisconnectConfirm.Visible = false;


            pnlNew.Visible             = true;
            pnlContent.Visible         = false;
            pnlScreenCast.Visible      = false;
            pnlAppShareSend.Visible    = false;
            pnlAppShareReceive.Visible = false;



            Guid sessionGUID;

            IncidentDS.IncidentDSDataTable dt = BllProxyIncident.SelectIncident(incidentId);

            if (dt.Rows.Count != 0)
            {
                sessionGUID = dt[0].incident_guid;


                string facilityName = dt[0].facility_name;
                string agentName    = dt[0].agent_full_name;


                lblAgentName.Text = agentName;

                //----------------------------------------------------------------------------
                String conferenceName = sessionGUID.ToString();



                ConferenceStartupParameters parameters1 = ConferenceHelper.GetParametersForTransmitter(conferenceName, facilityName);
                ConferenceStartupParameters parameters2 = ConferenceHelper.GetParametersForReceiver(conferenceName, agentName, facilityName);
                this.parameters = ConferenceHelper.GetParametersForScreenCast(conferenceName, facilityName, false);



                Session[Utility.ConferenceStartupParametersSessionVariableName] = this.parameters;


                parameters1.ScreenVideoWidth  = 320;
                parameters1.ScreenVideoHeight = 240;


                string tempConferenceName = Convert.ToString(1000000 + incidentId);
                //string tempConferenceName = conferenceName;


                parameters1.ConferenceName = tempConferenceName;



                parameters2.VideoWidth  = 640;
                parameters2.VideoHeight = 480;

                parameters2.ScreenVideoWidth  = 640;    // 320;
                parameters2.ScreenVideoHeight = 480;    // 240;
                parameters2.ConferenceName    = tempConferenceName;

                parameters.ConferenceName = tempConferenceName;


                UpdateVideoEvents(tempConferenceName);
                UpdateScreenEvents(tempConferenceName);
                UpdateAudioEvents(tempConferenceName);


                //this.startVideoTransmitter(parameters1);      // !!!!!
                //this.startVideoReceiver(parameters2);
                //this.startCreenCast(this.parameters);



                //--
                //TextChatControl.ConfSessionId = conferenceName;
                //TextChatControl.ConfSessionUser = facilityName;
                ViewChatControl.ConfSessionId   = conferenceName;
                ViewChatControl.ConfSessionUser = facilityName;
                //--


                //----------------------------------------------------------------------------
                startTime = DateTime.Now;
            }
            else
            {
                Response.Redirect("UcKioskConnect.aspx");
            }
        }
Esempio n. 11
0
        protected enumAgentStatus updateAgentStatus()
        {
            enumAgentStatus agentStatus = enumAgentStatus.NotDefined;



            if (this.active)
            {
                pnlNotRegistered.Visible = false;
                pnlIncomingCall.Visible  = false;
                pnlUnavailable.Visible   = false;
                pnlBusy.Visible          = false;
                pnlConnected.Visible     = false;
                pnlAvailable.Visible     = false;


                btnRegister.Visible     = false;
                btnTakeCall.Visible     = false;
                btnSetAvailable.Visible = false;
                btnReset.Visible        = false;
                btnUnRegister.Visible   = false;



                if (agentId == 0)
                {
                    // Not Defined
                    agentStatus = enumAgentStatus.NotDefined;

                    pnlNotRegistered.Visible = true;
                    ltMessage.Text           = "Not registered";
                    btnRegister.Visible      = true;
                }
                else
                {
                    PoolDS.PoolDSDataTable dt = BllProxyPool.SelectPoolAgent(agentId);
                    if (dt.Rows.Count != 0)
                    {
                        if (dt[0].is_available)
                        {
                            if (dt[0].is_busy)
                            {
                                if (!dt[0].Isincident_idNull())
                                {
                                    // Incoming Call
                                    agentStatus = enumAgentStatus.IncomingCall;

                                    Int32 incidentId = dt[0].incident_id;
                                    IncidentDS.IncidentDSDataTable dtIncident = BllProxyIncident.SelectIncident(incidentId);

                                    string callName = "";
                                    if (!dtIncident[0].Isfacility_nameNull())
                                    {
                                        callName = dtIncident[0].facility_name;
                                    }
                                    else
                                    {
                                        if (!dtIncident[0].Iscontact_full_nameNull())
                                        {
                                            callName = dtIncident[0].contact_full_name;
                                        }
                                        else
                                        {
                                            callName = "UNKNOWN";
                                        }
                                    }


                                    //    Incident Assigned
                                    pnlIncomingCall.Visible = true;
                                    ltMessage.Text          = "You’ve got a call : " + callName;

                                    btnTakeCall.Visible = true;
                                }
                                else
                                {
                                    //  Busy
                                    agentStatus = enumAgentStatus.Busy;


                                    if (this.checkOnline())
                                    {
                                        pnlConnected.Visible = true;
                                        pnlBusy.Visible      = false;
                                        ltMessage.Text       = "Online";
                                    }
                                    else
                                    {
                                        pnlBusy.Visible      = true;
                                        pnlConnected.Visible = false;
                                        ltMessage.Text       = "Offline";
                                        btnReset.Visible     = true;
                                    }
                                }
                            }
                            else
                            {
                                //  Available
                                agentStatus = enumAgentStatus.Available;

                                pnlAvailable.Visible  = true;
                                ltMessage.Text        = "Available";
                                btnUnRegister.Visible = true;
                            }
                        }
                        else
                        {
                            //  Off
                            agentStatus = enumAgentStatus.Unavailable;

                            if (this.checkOnline())
                            {
                                pnlConnected.Visible = true;
                                ltMessage.Text       = "Online";
                            }
                            else
                            {
                                pnlUnavailable.Visible  = true;
                                ltMessage.Text          = "Unavailable";
                                btnSetAvailable.Visible = true;
                            }
                        }
                    }
                    else
                    {
                        //  Not Defined
                        agentStatus = enumAgentStatus.NotDefined;

                        pnlNotRegistered.Visible = true;
                        ltMessage.Text           = "Not registered";
                        btnRegister.Visible      = true;
                    }
                }
            }



            return(agentStatus);
        }
        public void Start()
        {
            string script = "window.resizeTo( 360, 650 )";

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "SetLiveConnectSize", script, true);

            ltTimeSpan.Text   = "";
            lblAgentName.Text = "";

            Guid sessionGUID;

            IncidentDS.IncidentDSDataTable dt = BllProxyIncident.SelectIncident(incidentId);

            if (dt.Rows.Count != 0)
            {
                sessionGUID = dt[0].incident_guid;


                string facilityName = dt[0].facility_name;
                string agentName    = dt[0].agent_full_name;


                lblAgentName.Text = agentName;

                //----------------------------------------------------------------------------
                String conferenceName = sessionGUID.ToString();



                ConferenceStartupParameters parameters1 = ConferenceHelper.GetParametersForTransmitter(conferenceName, facilityName);
                ConferenceStartupParameters parameters2 = ConferenceHelper.GetParametersForReceiver(conferenceName, agentName, facilityName);
                this.parameters = ConferenceHelper.GetParametersForScreenCast(conferenceName, facilityName, false);



                Session[Utility.ConferenceStartupParametersSessionVariableName] = this.parameters;


                parameters1.ScreenVideoWidth  = 320;
                parameters1.ScreenVideoHeight = 240;


                string tempConferenceName = Convert.ToString(1000000 + incidentId);
                //string tempConferenceName = conferenceName;


                parameters1.ConferenceName = tempConferenceName;



                parameters2.VideoWidth  = 640;
                parameters2.VideoHeight = 480;

                parameters2.ScreenVideoWidth  = 640;    // 320;
                parameters2.ScreenVideoHeight = 480;    // 240;
                parameters2.ConferenceName    = tempConferenceName;

                parameters.ConferenceName = tempConferenceName;


                UpdateVideoEvents(tempConferenceName);
                UpdateScreenEvents(tempConferenceName);
                UpdateAudioEvents(tempConferenceName, incidentId);

                ViewChatControl.ConfSessionId   = conferenceName;
                ViewChatControl.ConfSessionUser = facilityName;

                //----------------------------------------------------------------------------
                startTime = DateTime.Now;
            }
            else
            {
                Response.Redirect("UcKioskConnect.aspx");
            }
        }