Esempio n. 1
0
        private void Connect(string appName, int addpClientTimeout, int addpServerTimeout, string addpTrace)
        {
            configServerId          = CConfServerIdentifier + Guid.NewGuid();
            confServerConfiguration = new ConfServerConfiguration(configServerId)
            {
                Uri                 = new Uri(configServerPrimaryUri),
                ClientName          = appName,
                UserName            = "",
                UserPassword        = "",
                WarmStandbyUri      = new Uri(configServerBackupUri),
                WarmStandbyAttempts = 5,
                UseAddp             = true,
                AddpClientTimeout   = addpClientTimeout,
                AddpServerTimeout   = addpServerTimeout,
                AddpTrace           = addpTrace
            };


            protocolManagementService = new ProtocolManagementService();
            protocolManagementService.ProtocolOpened += OnProtocolOpened;
            protocolManagementService.ProtocolClosed += OnProtocolClosed;
            protocolManagementService.Register(confServerConfiguration);

            eventBrokerService  = BrokerServiceFactory.CreateEventBroker(protocolManagementService.Receiver);
            confServiceContract = ConfServiceFactory.CreateConfService(protocolManagementService[configServerId], eventBrokerService);
            confServiceContract.Register(OnConfEvent);

            protocolManagementService.BeginOpen();
        }
Esempio n. 2
0
        public void InitializePSDKApplicationBlocks()
        {
            protocolManagementService = new ProtocolManagementService();

            isConfiguration = new InteractionServerConfiguration(ISERVER_IDENTIFIER);

            try
            {
                isConfiguration.Uri = new Uri(ISERVER_URI);
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
            isConfiguration.ClientName = CLIENT_NAME;
            isConfiguration.ClientType = InteractionClient.AgentApplication;

            protocolManagementService.Register(isConfiguration);

            protocolManagementService.ProtocolOpened += new EventHandler <ProtocolEventArgs>(this.OnProtocolOpened);
            protocolManagementService.ProtocolClosed += new EventHandler <ProtocolEventArgs>(this.OnProtocolClosed);

            eventBrokerService = new EventBrokerService(protocolManagementService.Receiver);
            eventBrokerService.Register(
                IServerEventsHandler,
                new MessageFilter(protocolManagementService[ISERVER_IDENTIFIER].ProtocolId));

            // Activate event broker service
            eventBrokerService.Activate();
            protocolManagementService[ISERVER_IDENTIFIER].Opened += MediaCall_Opened;
            protocolManagementService[ISERVER_IDENTIFIER].Closed += MediaCall_Closed;
        }
Esempio n. 3
0
        private static void InitializePSDKApplicationBlocks()
        {
            // Setup Application Blocks:

            // Create Protocol Manager Service object
            protocolManagementService = new ProtocolManagementService();

            // Create and initialize connection configuration object for TServer.
            confServerConfiguration = new ConfServerConfiguration(CONFIGSERVER_IDENTIFIER);

            var ConfServerURI = WebConfigurationManager.AppSettings["CfgServer.URI"];
            var ClientName    = WebConfigurationManager.AppSettings["CfgServer.ClientName"];
            var UserName      = WebConfigurationManager.AppSettings["CfgServer.UserName"];
            var UserPassword  = WebConfigurationManager.AppSettings["CfgServer.UserPassword"];

            // Set required values
            try
            {
                confServerConfiguration.Uri = new Uri(ConfServerURI);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);
            }

            confServerConfiguration.ClientName   = ClientName;
            confServerConfiguration.UserName     = UserName;
            confServerConfiguration.UserPassword = UserPassword;


            if (System.Web.Configuration.WebConfigurationManager.AppSettings["CfgServer.HASupport"] == "1")
            {
                var uriBakup = System.Web.Configuration.WebConfigurationManager.AppSettings["CfgServer.URI_BAKUP"];
                confServerConfiguration.WarmStandbyAttempts = 3;
                confServerConfiguration.WarmStandbyTimeout  = 3000;
                confServerConfiguration.WarmStandbyUri      = new Uri(uriBakup);
                confServerConfiguration.FaultTolerance      = FaultToleranceMode.WarmStandby;
            }

            // Register this connection configuration with Protocol Manager
            protocolManagementService.Register(confServerConfiguration);

            protocolManagementService.ProtocolOpened += new EventHandler <ProtocolEventArgs>(OnProtocolOpened);
            protocolManagementService.ProtocolClosed += new EventHandler <ProtocolEventArgs>(OnProtocolClosed);

            // Create and Initialize Message Broker Application Block
            eventBrokerService = new EventBrokerService(protocolManagementService.Receiver);

            // Activate event broker service
            eventBrokerService.Activate();

            confService = ConfServiceFactory.CreateConfService(
                protocolManagementService[CONFIGSERVER_IDENTIFIER],
                eventBrokerService);

            eventBrokerService.Register(
                eventConfServerEventsHandler,
                new MessageFilter(protocolManagementService[CONFIGSERVER_IDENTIFIER].ProtocolId));
        }
Esempio n. 4
0
        private void InitializePSDKApplicationBlocks()
        {
            // Setup Application Blocks:

            // Create Protocol Manager Service object
            protocolManagementService = new ProtocolManagementService();

            // Create and initialize connection configuration object for TServer.
            outboundServerConfiguration = new OutboundServerConfiguration(OCS_IDENTIFIER);

            // Set required values
            try
            {
                outboundServerConfiguration.Uri = new Uri(OCS_URI);
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message + "\n" + ex.StackTrace + "\n");
            }

            outboundServerConfiguration.ClientName = CLIENT_NAME;

            // Register this connection configuration with Protocol Manager
            protocolManagementService.Register(outboundServerConfiguration);

            protocolManagementService.ProtocolOpened += new EventHandler <ProtocolEventArgs>(this.OnProtocolOpened);
            protocolManagementService.ProtocolClosed += new EventHandler <ProtocolEventArgs>(this.OnProtocolClosed);


            // Create and Initialize Message Broker Application Block
            eventBrokerService = new EventBrokerService(protocolManagementService.Receiver);

            eventBrokerService.Register(
                OutboundServerEventsHandler,
                new MessageFilter(protocolManagementService[OCS_IDENTIFIER].ProtocolId));

            // Activate event broker service
            eventBrokerService.Activate();
        }
Esempio n. 5
0
        public void InicializaComunicacao()
        {
            try
            {
                //Create Protocol Manager Service object
                pmsTServer = new ProtocolManagementService();

                //Create and initialize connection configuration object for TServer
                TServerConfiguration tsc = new TServerConfiguration(TSERVER_IDENTIFIER);
                tsc.Uri = new Uri(TSERVER_URI);
                tsc.ClientName = TSERVER_CLIENT_NAME;
                tsc.ClientPassword = GENESYS_PASSWORD;

                pmsTServer.Register(tsc);
                pmsTServer.ProtocolOpened += new EventHandler<ProtocolEventArgs>(this.onProtocolOpenedTServer);
                pmsTServer.ProtocolClosed += new EventHandler<ProtocolEventArgs>(this.onProtocolClosedTServer);

                IProtocol p = pmsTServer[TSERVER_IDENTIFIER];
                p.Received += TServerEventsHandler;

                if (p.State == ChannelState.Closed)
                {
                    p.BeginOpen();
                    Thread.Sleep(3000);
                }
                else
                {
                    EnviaMensagemSignalR("ServidorCTI-Erro", "InicializaComunicacao(...) - falha 001 - estado do protocolo: " + p.State);
                }
                pmsTServer[TSERVER_IDENTIFIER].CopyResponse = true;
                RegistraPlace(this.PA);
            }
            catch (Exception ex)
            {
                EnviaMensagemSignalR("ServidorCTI-Erro", "InicializaComunicacao(...) - exception: " + ex.Message);
            }
        }