示例#1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            Session s = new Session();

            SessionSettings sessionSettings = new SessionSettings();

            sessionSettings.ClassOfService  = ClassOfService.General;
            sessionSettings.IsoLanguage     = "en-US";
            sessionSettings.ApplicationName = "i3lets";

            HostSettings hostSettings = new HostSettings();

            hostSettings.HostEndpoint = new HostEndpoint(Host, HostEndpoint.DefaultPort);

            AuthSettings authSettings;

            if (String.IsNullOrEmpty(UserName) || Password == null)
            {
                authSettings = new WindowsAuthSettings();
            }
            else
            {
                authSettings = new ICAuthSettings(UserName, Password);
            }

            StationSettings stationSettings = new StationlessSettings();

            s.Connect(sessionSettings, hostSettings, authSettings, stationSettings);

            StaticDataStore.AddSession(s);

            WriteObject(s);
        }
示例#2
0
 public void SetAuthSettings()
 {
     if (WindowsAuth)
     {
         AuthSettings = new WindowsAuthSettings();
     }
     else
     {
         AuthSettings = new ICAuthSettings(UserName, Password);
     }
 }
示例#3
0
        public SignInStatus Login(string server, string user, string password)
        {
            try
            {
                var session_settings = new SessionSettings();
                var host_settings = new HostSettings(new HostEndpoint(server));
                var auth_settings = new ICAuthSettings(user, password);

                ICSession = new Session();
                session_settings.ApplicationName = "DialerNetAPIDemo";

                ICSession.ConnectionStateChanged += ICSession_ConnectionStateChanged;
                ICSession.Connect(session_settings, host_settings, auth_settings, new StationlessSettings());

                DialerConfiguration = new DialerConfigurationManager(ICSession);

                InitializeCampaigns(ICSession);
                InitializeWorkgroups(ICSession);
                InitializeContactLists(ICSession);
                InitializePolicySets(ICSession);
                return SignInStatus.Success;
            }
            catch(ININ.IceLib.Connection.RequestTimeoutException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Timeout while connecting", e);
            }
            catch(ININ.IceLib.Connection.SessionDisconnectedException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect", e);
            }
            catch(ININ.IceLib.IceLibLicenseException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Cannot connect, missing license", e);

            }
            catch(ININ.IceLib.IceLibException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect", e);
            }
            catch(System.ObjectDisposedException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect, session was disposed", e);
            }
            catch (Exception e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unknown error while connecting", e);
            }
            return SignInStatus.Failure;
        }
示例#4
0
        public SignInStatus Login(string server, string user, string password)
        {
            try
            {
                var session_settings = new SessionSettings();
                var host_settings    = new HostSettings(new HostEndpoint(server));
                var auth_settings    = new ICAuthSettings(user, password);

                ICSession = new Session();
                session_settings.ApplicationName = "DialerNetAPIDemo";

                ICSession.ConnectionStateChanged += ICSession_ConnectionStateChanged;
                ICSession.Connect(session_settings, host_settings, auth_settings, new StationlessSettings());

                DialerConfiguration = new DialerConfigurationManager(ICSession);

                InitializeCampaigns(ICSession);
                InitializeWorkgroups(ICSession);
                InitializeContactLists(ICSession);
                InitializePolicySets(ICSession);
                return(SignInStatus.Success);
            }
            catch (ININ.IceLib.Connection.RequestTimeoutException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Timeout while connecting", e);
            }
            catch (ININ.IceLib.Connection.SessionDisconnectedException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect", e);
            }
            catch (ININ.IceLib.IceLibLicenseException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Cannot connect, missing license", e);
            }
            catch (ININ.IceLib.IceLibException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect", e);
            }
            catch (System.ObjectDisposedException e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unable to connect, session was disposed", e);
            }
            catch (Exception e)
            {
                HttpContext.Current.Trace.Warn("CIC", "Unknown error while connecting", e);
            }
            return(SignInStatus.Failure);
        }
        private void Connect()
        {
            _connectAttempts++;
            if (String.IsNullOrEmpty(_server))
            {
                _server = _server1;
            }
            _session = new Session();
            _session.ConnectionStateChanged += session_ConnectionStateChanged;

            if (_session.ConnectionState != ConnectionState.Up)
            {
                _logging.TraceMessage(0, "Qsect WebChatBuilder is trying to connect to: " + _server);
                try
                {
                    SessionSettings sessionSettings = new SessionSettings();
                    HostSettings    hostSettings    = new HostSettings();
                    hostSettings.HostEndpoint = new HostEndpoint(_server, HostEndpoint.DefaultPort);

                    StationSettings stationSettings = new StationlessSettings();
                    AuthSettings    authSettings    = new WindowsAuthSettings();
                    var             userName        = _user;
                    var             password        = _password;
                    if (!String.IsNullOrEmpty(userName) && !String.IsNullOrEmpty(password))
                    {
                        authSettings = new ICAuthSettings(userName, password);
                    }

                    _session.ConnectAsync(sessionSettings, hostSettings, authSettings, stationSettings, session_ConnectCompleted, null);
                }
                catch (Exception Ex)
                {
                    PartialUnload();
                    _logging.TraceException(Ex, "Error connecting to CIC");
                    _server = _server == _server1 ? _server2 : _server1;
                    TryToReconnect();
                }
            }
        }