Example #1
0
        protected bool Execute(string commandLine, bool shouldSucceed = true)
        {
            bool result = CApp.ExecCommand(commandLine, true);

            Assert.IsFalse(result ^ shouldSucceed, "Command should " + (shouldSucceed ? "succeed" : "fail") + ": " + commandLine);
            return(result);
        }
Example #2
0
 public HttpResponseMessage LogoutPost([FromBody] AgentParameters agent)
 {
     try
     {
         if (MainObject.MainList.ContainsKey(agent.User.AgentId))
         {
             CApp mpApp    = MainObject.MainList[agent.User.AgentId];
             var  response = mpApp.Logout(agent.Logout, mpApp);
             if (response == HttpStatusCode.OK)
             {
                 MainObject.MainEventList.Remove(agent.User.AgentId);
                 //MainObject.MainList.Remove(agent.User.AgentId);
                 return(Request.CreateResponse(HttpStatusCode.OK, "OK"));
             }
             else
             {
                 return(Request.CreateResponse(response, "Error logout"));
             }
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, "Agent Not Found"));
         }
     }
     catch (Exception ex)
     {
         Log.logException(ex);
         return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
     }
 }
Example #3
0
 private void UpdateDictionary(string key, CApp value)
 {
     MainObject.MainList.Remove(key);
     if (string.IsNullOrEmpty(MainObject.MainList.FirstOrDefault(x => x.Key == key).Key))
     {
         MainObject.MainList.Add(value.CurrentAgent.AgentId, value);
     }
 }
Example #4
0
 public HttpResponseMessage TransferPost([FromBody] AgentParameters agent)
 {
     try
     {
         if (MainObject.MainList.ContainsKey(agent.User.AgentId))
         {
             object obj   = new CSimpleService(agent.Transfer.ServiceId, agent.Transfer.ServiceName, agent.Transfer.ServiceType);
             CApp   mpApp = MainObject.MainList[agent.User.AgentId];
             //If Consulting or Conferenced, transfer the call to the consulted party
             if (mpApp.CurrentState is CStateConsulting || mpApp.CurrentState is CStateConference)
             {
                 mpApp.Transfer();
                 return(Request.CreateResponse(HttpStatusCode.OK, "OK"));
             }
             else
             {
                 if (!string.IsNullOrEmpty(agent.Transfer.PhoneNumber))
                 {
                     if (obj is CExternalRoute)
                     {
                         mpApp.Transfer(agent.Transfer.PhoneNumber, (CExternalRoute)obj);
                         return(Request.CreateResponse(HttpStatusCode.OK, "OK (External Route)"));
                     }
                     else
                     {
                         mpApp.Transfer(agent.Transfer.PhoneNumber);
                         return(Request.CreateResponse(HttpStatusCode.OK, "OK (PhoneNumber)"));
                     }
                 }
                 else if (obj is CUser)
                 {
                     mpApp.Transfer((CUser)obj);
                     return(Request.CreateResponse(HttpStatusCode.OK, "OK (User)"));
                 }
                 else if (obj is CSimpleService)
                 {
                     mpApp.Transfer((CSimpleService)obj);
                     return(Request.CreateResponse(HttpStatusCode.OK, "OK (Simple Service)"));
                 }
                 return(Request.CreateResponse(HttpStatusCode.BadRequest, ""));
             }
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.BadRequest, ""));
         }
     }
     catch (Exception ex)
     {
         Log.logException(ex);
         return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message + "PhoneNumber: " + agent.Transfer.PhoneNumber));
     }
 }
Example #5
0
        public IEnumerable <string> GetDisposition([FromUri] UserParameters user)
        {
            try
            {
                if (MainObject.MainList.ContainsKey(user.AgentId))
                {
                    CApp mpApp = MainObject.MainList[user.AgentId];

                    string        json         = string.Empty;
                    CDispositions dispositions = mpApp.CurrentService.DispositionPlan.Dispositions;
                    if (dispositions != null)
                    {
                        List <CallDispositionParameters> list = new List <CallDispositionParameters>();
                        foreach (CDisposition item in dispositions)
                        {
                            CallDispositionParameters cdp = new CallDispositionParameters();
                            cdp.Id          = item.Id;
                            cdp.Code        = item.Code;
                            cdp.Description = item.Description;
                            list.Add(cdp);
                        }
                        if (list.Count > 0)
                        {
                            json = JsonConvert.SerializeObject(list);
                        }
                        else
                        {
                            json = string.Empty;
                        }

                        return(new string[] { json.Replace(@"\", "") });
                    }
                    else
                    {
                        return(new string[] { "" });
                    }
                }
                else
                {
                    return(new string[] { "" });
                }
            }
            catch (Exception ex)
            {
                Log.logException(ex);
                return(new string[] { "" });
            }
        }
Example #6
0
 private void MyApp_Screenpop(object pSender, CScreenpopArgs pArgs)
 {
     try
     {
         CApp mpApp = (CApp)pSender;
         if (MainObject.MainEventList.ContainsKey(mpApp.CurrentAgent.AgentId))
         {
             MainObject.MainEventList[mpApp.CurrentAgent.AgentId].Call.ShowScreenPop = true;
         }
     }
     catch (Exception ex)
     {
         Log.logException(ex);
         throw ex;
     }
 }
Example #7
0
        public IEnumerable <string> GetServicesTransfer([FromUri] UserParameters user)
        {
            try
            {
                List <TransferServicesParameters> listTransfer = new List <TransferServicesParameters>();
                if (MainObject.MainList.ContainsKey(user.AgentId))
                {
                    CApp mpApp = MainObject.MainList[user.AgentId];

                    var services = mpApp.GetServices();
                    foreach (CSimpleService item in services)
                    {
                        TransferServicesParameters tsp = new TransferServicesParameters();
                        tsp.ServiceId   = item.ServiceId;
                        tsp.ServiceName = item.ServiceName;
                        tsp.ServiceType = item.ServiceType;
                        listTransfer.Add(tsp);
                    }

                    if (listTransfer.Count > 0)
                    {
                        string json = JsonConvert.SerializeObject(listTransfer);
                        if (json != string.Empty)
                        {
                            return(new string[] { json.Replace(@"\", "") });
                        }
                        else
                        {
                            return(new string[] { "" });
                        }
                    }
                    else
                    {
                        return(new string[] { "" });
                    }
                }
                else
                {
                    return(new string[] { "" });
                }
            }
            catch (Exception ex)
            {
                Log.logException(ex);
                return(new string[] { "" });
            }
        }
Example #8
0
        public IEnumerable <string> GetServicesAgent([FromUri] UserParameters user)
        {
            try
            {
                if (MainObject.MainList.ContainsKey(user.AgentId))
                {
                    CApp mpApp = MainObject.MainList[user.AgentId];

                    string json = string.Empty;
                    if (mpApp.AssignedServices != null)
                    {
                        List <DialServiceParameters> list = new List <DialServiceParameters>();
                        foreach (CService item in mpApp.AssignedServices)
                        {
                            DialServiceParameters dsp = new DialServiceParameters();
                            dsp.ServiceId   = item.ServiceId.ToString();
                            dsp.ServiceName = item.ServiceName;
                            list.Add(dsp);
                        }
                        if (list.Count > 0)
                        {
                            json = JsonConvert.SerializeObject(list);
                        }
                        else
                        {
                            json = string.Empty;
                        }

                        return(new string[] { json.Replace(@"\", "") });
                    }
                    else
                    {
                        return(new string[] { "" });
                    }
                }
                else
                {
                    return(new string[] { "" });
                }
            }
            catch (Exception ex)
            {
                Log.logException(ex);
                return(new string[] { "" });
            }
        }
Example #9
0
        public HttpResponseMessage HoldPost([FromBody] AgentParameters agent)
        {
            try
            {
                if (MainObject.MainList.ContainsKey(agent.User.AgentId))
                {
                    CApp mpApp = MainObject.MainList[agent.User.AgentId];

                    if (agent.Dial.HoldState == true)
                    {
                        if (mpApp.ReleaseHold(agent.Dial, mpApp))
                        {
                            return(Request.CreateResponse(HttpStatusCode.OK, "OK"));
                        }
                        else
                        {
                            return(Request.CreateResponse(HttpStatusCode.BadRequest, "Current Call Not Found!"));
                        }
                    }
                    else
                    {
                        if (mpApp.Hold(agent.Dial, mpApp))
                        {
                            return(Request.CreateResponse(HttpStatusCode.OK, "OK"));
                        }
                        else
                        {
                            return(Request.CreateResponse(HttpStatusCode.BadRequest, "Current Call Not Found!"));
                        }
                    }
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, "Agent Not Found!"));
                }
            }
            catch (Exception ex)
            {
                Log.logException(ex);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Example #10
0
        // 静的メソッド

        public static void t初期化(CApp app)
        {
            Global.App    = app;
            Global.Folder = new Folder();                                       // ユーザ個別フォルダのみユーザ依存
#if n
            Global.PlayerMode            = new PlayerMode();
            Global.Users                 = Users.t読み込む(Global.Folder.strUsersXMLの絶対パス);
            Global.Input                 = new Input();
            Global.Song                  = new Song();
            Global.Stage                 = new Stage();
            Global.VirtualDrums          = new VirtualDrums();                                                                       // ユーザ依存
            Global.Theme                 = new Theme();                                                                              // ユーザ依存
            Global.EnvironmentProperties = StrokeStyleT.EnvironmentParameters.t読み込む(Global.Folder.strEnvironmentPropertiesXMLの絶対パス); // 環境依存
            Global.rc演奏用タイマ              = null;                                                                                     // Global.Bass 依存(つまりユーザ依存)
            Global.Actフリップボード            = new CMActフリップボード(Global.Theme.TextureFormat);
            Global.Act英数字描画              = new CAct英数字描画();
#endif
            Global.SoundDevice     = null;                                                              // ユーザ依存
            Global.bウィンドウがアクティブである = false;
        }
Example #11
0
        public HttpResponseMessage HangupPost([FromBody] UserParameters user)
        {
            try
            {
                if (MainObject.MainList.ContainsKey(user.AgentId))
                {
                    CApp mpApp = MainObject.MainList[user.AgentId];

                    mpApp.Hangup(mpApp.CurrentCall, mpApp);
                    return(Request.CreateResponse(HttpStatusCode.OK, "OK"));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound, "Agent Not Found"));
                }
            }
            catch (Exception ex)
            {
                Log.logException(ex);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Example #12
0
        public HttpResponseMessage AvailablePost([FromBody] UserParameters user)
        {
            try
            {
                if (MainObject.MainList.ContainsKey(user.AgentId))
                {
                    CApp mpApp = MainObject.MainList[user.AgentId];

                    mpApp.BecomeAvailable();
                    return(Request.CreateResponse(HttpStatusCode.OK, "Available (OK)"));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound, "Agent Not Found"));
                }
            }
            catch (Exception ex)
            {
                Log.logException(ex);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Example #13
0
        public HttpResponseMessage UnavailablePost([FromBody] AgentParameters agent)
        {
            try
            {
                if (MainObject.MainList.ContainsKey(agent.User.AgentId))
                {
                    CApp            mpApp  = MainObject.MainList[agent.User.AgentId];
                    CNotReadyReason reason = new CNotReadyReason(agent.Unavailable.Id, agent.Unavailable.Description);
                    bool            park   = agent.Unavailable.Park;

                    mpApp.BecomeUnavailable(reason, park);
                    return(Request.CreateResponse(HttpStatusCode.OK, "Unavailable (OK)"));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound, "Agent Not Found"));
                }
            }
            catch (Exception ex)
            {
                Log.logException(ex);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Example #14
0
 internal CExternalRoutes(CApp pApp)
 {
     mpApp = pApp;
 }
Example #15
0
 internal CAssignedServices(CApp pApp)
 {
     mpApp = pApp;
 }
Example #16
0
 internal CLogoutReasons(CApp pApp)
 {
     mpApp = pApp;
 }
Example #17
0
        public void CApp_StateChange(Object pSender, CStateChangeArgs pArgs)
        {
            try
            {
                CState pNewState = pArgs.NewState;
                CApp   obj       = (CApp)pSender;

                switch (pArgs.NewState.Id)
                {
                case AgentStateId.asACTIVE:
                    MainObject.MainEventList[obj.CurrentAgent.AgentId].Call.Name = obj.CurrentAgent.AgentId;
                    if (obj.CurrentCall != null)
                    {
                        MainObject.MainEventList[obj.CurrentAgent.AgentId].Call.CallId      = obj.CurrentCall.CallID;
                        MainObject.MainEventList[obj.CurrentAgent.AgentId].Call.PhoneNumber = obj.CurrentCall.PhoneNumber;
                        MainObject.MainEventList[obj.CurrentAgent.AgentId].Call.Name        = obj.CurrentCall.FirstName;
                    }
                    MainObject.MainEventList[obj.CurrentAgent.AgentId].StateAgentId = (StateAgentId)pArgs.NewState.Id;
                    MainObject.MainList[obj.CurrentAgent.AgentId].DateState         = DateTime.Now;
                    break;

                case AgentStateId.asPREVIEW:
                    MainObject.MainEventList[obj.CurrentAgent.AgentId].Call.CallId        = obj.CurrentCall.CallID;
                    MainObject.MainEventList[obj.CurrentAgent.AgentId].Call.Name          = obj.CurrentCall.FirstName;
                    MainObject.MainEventList[obj.CurrentAgent.AgentId].Call.ShowScreenPop = false;
                    MainObject.MainEventList[obj.CurrentAgent.AgentId].Call.PhoneNumber   = obj.CurrentCall.PhoneNumber;
                    MainObject.MainEventList[obj.CurrentAgent.AgentId].StateAgentId       = (StateAgentId)pArgs.NewState.Id;
                    MainObject.MainList[obj.CurrentAgent.AgentId].DateState = DateTime.Now;
                    break;

                case AgentStateId.asAUTHENTICATED:
                    if (!string.IsNullOrEmpty(MainObject.MainList.FirstOrDefault(x => x.Key == obj.CurrentAgent.AgentId).Key))
                    {
                        MainObject.MainList.Remove(obj.CurrentAgent.AgentId);
                        MainObject.MainEventList.Remove(obj.CurrentAgent.AgentId);
                    }
                    MainObject.MainList.Add(obj.CurrentAgent.AgentId, myApp);
                    GenericObjectParameters rcp = new GenericObjectParameters();
                    rcp.StateAgentId = (StateAgentId)pArgs.NewState.Id;
                    rcp.Call.Name    = obj.CurrentAgent.AgentId;
                    MainObject.MainEventList.Add(obj.CurrentAgent.AgentId, rcp);
                    MainObject.MainList[obj.CurrentAgent.AgentId].DateState       = DateTime.Now;
                    MainObject.MainList[obj.CurrentAgent.AgentId].Date_Last_Login = DateTime.Now;
                    break;

                case AgentStateId.asLOGGING_IN:
                case AgentStateId.asIDLE:
                case AgentStateId.asDIALING:
                case AgentStateId.asDIALING_CONSULTATION:
                case AgentStateId.asRINGING:
                case AgentStateId.asWRAP:
                case AgentStateId.asHELD:
                case AgentStateId.asWAITING:
                case AgentStateId.asLOGGED_OUT:
                case AgentStateId.asACTIVE_INTERNAL:
                case AgentStateId.asNOT_READY:
                case AgentStateId.asPARKED:
                case AgentStateId.asCONSULTING:
                case AgentStateId.asCONFERENCE:
                case AgentStateId.asCHATTING:
                case AgentStateId.asINACTIVE:
                    MainObject.MainEventList[obj.CurrentAgent.AgentId].StateAgentId = (StateAgentId)pArgs.NewState.Id;
                    MainObject.MainList[obj.CurrentAgent.AgentId].DateState         = DateTime.Now;
                    break;
                }
            }
            catch (Exception ex)
            {
                Log.logException(ex);
            }
        }
Example #18
0
        public HttpResponseMessage NextCallPost([FromBody] AgentParameters agent)
        {
            try
            {
                if (MainObject.MainList.ContainsKey(agent.User.AgentId))
                {
                    CApp mpApp = MainObject.MainList[agent.User.AgentId];

                    if (mpApp.CurrentService.RequireDisposition)
                    {
                        if (agent.DispositionClass != null)
                        {
                            CDisposition pDisp;
                            if (mpApp.CurrentCall != null && mpApp.CurrentCall.CurrentState is CStatePreview)
                            {
                                pDisp = new CDisposition(agent.DispositionClass.Id, agent.DispositionClass.Description,
                                                         agent.DispositionClass.Code, true, false, false);
                            }
                            else
                            {
                                pDisp = new CDisposition(agent.DispositionClass.Id, agent.DispositionClass.Description,
                                                         agent.DispositionClass.Code, false, false, false);
                            }

                            try
                            {
                                if (agent.DispositionClass.Id == 1005 || agent.DispositionClass.Id == 1006)
                                {
                                    string nameCustomer = mpApp.CurrentCall.FirstName;
                                    string phonenumber  = mpApp.CurrentCall.PhoneNumber;

                                    mpApp.ScheduleCallback(mpApp.CurrentCall, pDisp, agent.DispositionClass.Date);
                                    mpApp.DisposeCall(mpApp.CurrentCall, pDisp);

                                    ScheduleParameters scheduleparameters = new ScheduleParameters();
                                    scheduleparameters.Id_Disposition          = pDisp.Id;
                                    scheduleparameters.Description_Disposition = pDisp.Description;
                                    scheduleparameters.Name_Customer           = nameCustomer;
                                    scheduleparameters.PhoneNumber             = phonenumber;
                                    scheduleparameters.AgentId       = agent.User.AgentId;
                                    scheduleparameters.Date_Schedule = agent.DispositionClass.Date;

                                    return(Request.CreateResponse(HttpStatusCode.OK, scheduleparameters));
                                }
                                else
                                {
                                    mpApp.DisposeCall(mpApp.CurrentCall, pDisp);
                                    return(Request.CreateResponse(HttpStatusCode.OK, "OK"));
                                }
                            }
                            catch (Exception ex)
                            {
                                Log.logException(ex);
                                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
                            }
                        }
                        else
                        {
                            try
                            {
                                mpApp.DisposeCall(mpApp.CurrentCall, null);
                                return(Request.CreateResponse(HttpStatusCode.OK, "OK"));
                            }
                            catch (Exception ex)
                            {
                                Log.logException(ex);
                                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
                            }
                        }
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.NotAcceptable, "Not Require Disposition"));
                    }
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound, "Agent Not Found"));
                }
            }
            catch (Exception ex)
            {
                Log.logException(ex);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Example #19
0
 internal CAgents(CApp pApp)
 {
     mpApp = pApp;
 }
Example #20
0
 internal CSupervisors(CApp pApp)
 {
     mpApp = pApp;
 }
Example #21
0
 internal CNotReadyReasons(CApp pApp)
 {
     mpApp = pApp;
 }
Example #22
0
 internal CServices(CApp pApp)
 {
     mpApp = pApp;
 }
Example #23
0
 public AgentController()
 {
     myApp              = new CApp();
     myApp.Screenpop   += MyApp_Screenpop;
     myApp.StateChange += CApp_StateChange;
 }
Example #24
0
 internal CCallRejectionReasons(CApp pApp)
 {
     mpApp = pApp;
 }
Example #25
0
 internal CDispositionPlans(CApp pApp)
 {
     mpApp          = pApp;
     mpDispositions = new CDispositions();
 }