Ejemplo n.º 1
0
 public Call(FormDialPad dialPad)
 {
     CallSessionId    = string.Empty;
     AgentSessionId   = string.Empty;
     PortSipSessionId = -1;
     _dialPad         = dialPad;
     UserAuth         = dialPad.Auth;
 }
Ejemplo n.º 2
0
 public PortsipHandler(FormDialPad formDialPad)
 {
     portsip = new PortSIPCore(0, formDialPad);
 }
Ejemplo n.º 3
0
        private void UserLogin()
        {
            try
            {
                var settingObject = System.Configuration.ConfigurationSettings.AppSettings;
                var company       = settingObject["Company"];
                var auth          = DuoAuth.DuoAuthorizationService.Login(txtUserName.Text.Trim(), txtPassword.Text.Trim(),
                                                                          int.Parse(company), "DuoSoftPhone");

                if (auth == null)
                {
                    throw new Exception("Fail to Login to Auth.");
                }

                var result = ArdsHandler.ResourceRegistration(auth, GetLocalIPAddress());

                if (result.Command == WorkflowResultCode.ACDS101)
                {
                    result = ArdsHandler.SendStatusChangeRequestIdel(auth, result.SessionID);
                    if (result.Command == WorkflowResultCode.ACDS403 || result.Command == WorkflowResultCode.ACDS405)
                    {
                        result = ArdsHandler.SendModeChangeRequestInbound(auth);
                        if (result.Command == WorkflowResultCode.ACDS601 || result.Command == WorkflowResultCode.ACDS501)
                        {
                            var sip = ProfileManagementHandler.GetSipProfile(auth.SecurityToken, auth.guUserId);
                            if (string.IsNullOrEmpty(sip.userName))
                            {
                                Logger.Instance.LogMessage(Logger.LoggerFiles.DuoDefault, "Fail to get SIP Profile info", Logger.LogLevel.Error);
                                throw new Exception("Fail to get SIP Profile info.");
                            }

                            // set agent status
                            _agent = new Agent
                            {
                                AgentCurrentState = new AgentInitiate(),
                                AgentCurrentMode  = AgentMode.Inbound,
                                SipProfile        = sip,
                                AgentSessionId    = SessionId.UniqueId(txtUserName.Text.Trim()),
                                UserAuth          = auth,
                            };
                            var frm = new FormDialPad(auth, _agent.AgentSessionId, sip, _agent);
                            _agent.AgentCurrentState.OnLogOn(ref _agent, string.Empty);
                            Hide();
                            frm.ShowDialog(this);
                            this.Close();
                            Environment.Exit(0);
                            return;
                        }
                        else
                        {
                            Logger.Instance.LogMessage(Logger.LoggerFiles.DuoDefault, "Fail to set Agent Mode",
                                                       Logger.LogLevel.Error);
                            MessageBox.Show("Fail to set Agent Mode", "Duo Dialer", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        Logger.Instance.LogMessage(Logger.LoggerFiles.DuoDefault, "Fail to set Agent Status",
                                                   Logger.LogLevel.Error);
                        MessageBox.Show("Fail to set Agent Status", "Duo Dialer", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    Logger.Instance.LogMessage(Logger.LoggerFiles.DuoDefault, "Fail to ResourceRegistration",
                                               Logger.LogLevel.Error);
                    MessageBox.Show("Resource Registration Fail", "Duo Dialer", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                ArdsHandler.ResourceUnregistration(auth);
            }
            catch (Exception exception)
            {
                Logger.Instance.LogMessage(Logger.LoggerFiles.DuoDefault, "Login fail", exception, Logger.LogLevel.Error);
                MessageBox.Show("Login Fail", "Duo Dialer", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            txtPassword.Text = string.Empty;
        }
Ejemplo n.º 4
0
 public AddFavorite(FormDialPad frm)
     : base()
 {
     this.InitializeComponent();
     myMainForm = frm;
 }