private static IConfService OpenCfg() { var ConfServerURI = WebConfigurationManager.AppSettings["CfgServer.URI"]; var ClientName = WebConfigurationManager.AppSettings["CfgServer.ClientName"]; var UserName = WebConfigurationManager.AppSettings["CfgServer.UserName"]; var UserPassword = WebConfigurationManager.AppSettings["CfgServer.UserPassword"]; Endpoint confServerUri = new Endpoint(new Uri(ConfServerURI)); ConfServerProtocol cfgServiceProtocol; EventBrokerService _eventBrokerService; cfgServiceProtocol = new ConfServerProtocol(confServerUri); cfgServiceProtocol.ClientName = ClientName; cfgServiceProtocol.UserName = UserName; cfgServiceProtocol.UserPassword = UserPassword; cfgServiceProtocol.ClientApplicationType = (int)CfgAppType.CFGSCE; try { cfgServiceProtocol.Open(); } catch (ProtocolException e) { log.Error(e.Message); } catch (Exception e) { log.Error(e.Message); } _eventBrokerService = BrokerServiceFactory.CreateEventBroker(cfgServiceProtocol); IConfService cfgService = ConfServiceFactory.CreateConfService(cfgServiceProtocol, _eventBrokerService); return(cfgService); }
public static IConfService InitializeConfigService(string cfgsrvHost, int cfgsrvPort, string username, string password) { Endpoint confServerUri = new Endpoint(new Uri("tcp://" + cfgsrvHost + ":" + cfgsrvPort)); String _clientName = "default"; ConfServerProtocol cfgServiceProtocol; EventBrokerService _eventBrokerService; cfgServiceProtocol = new ConfServerProtocol(confServerUri); cfgServiceProtocol.ClientName = _clientName; cfgServiceProtocol.UserName = username; cfgServiceProtocol.UserPassword = password; cfgServiceProtocol.ClientApplicationType = (int)CfgAppType.CFGSCE; try { cfgServiceProtocol.Open(); } catch (ProtocolException e) { log.Info(e.Message); } catch (Exception e) { log.Info(e.Message); } _eventBrokerService = BrokerServiceFactory .CreateEventBroker(cfgServiceProtocol); IConfService cfgService = ConfServiceFactory.CreateConfService( cfgServiceProtocol, _eventBrokerService); return(cfgService); }
/// <summary> /// Gets or creates an <see cref="IConfService"/> from the provided <paramref name="protocol"/>. /// </summary> /// <param name="protocol">The protocol object to retrieve a Service from.</param> /// <returns>An <see cref="IConfService"/> instance.</returns> public static IConfService GetConfService(this ConfServerProtocol protocol) => ConfServiceFactory.RetrieveConfService(protocol) ?? ConfServiceFactory.CreateConfService(protocol);
/// <summary> /// Creates an instance of <see cref="DirectoryNumberRepo"/> using the provided <paramref name="protocol"/>. /// </summary> /// <param name="protocol">The Config Server Protocol object that will handle requests.</param> /// <returns>An instance of <see cref="DirectoryNumberRepo"/> using the provided <paramref name="protocol"/>.</returns> public override ICtiFeature Create(ConfServerProtocol protocol) => new DirectoryNumberRepo { Protocol = protocol };
/// <summary> /// Creates an instance of <see cref="HostRepo"/> using the provided <paramref name="protocol"/>. /// </summary> /// <param name="protocol">The Config Server Protocol object that will handle requests.</param> /// <returns>An instance of <see cref="HostRepo"/> using the provided <paramref name="protocol"/>.</returns> public override ICtiFeature Create(ConfServerProtocol protocol) => new HostRepo { Protocol = protocol };
private void confserv() { try { IAgent agent = container.Resolve <IAgent>(); #region ADDP settings PropertyConfiguration config = new PropertyConfiguration(); config.UseAddp = true; config.AddpServerTimeout = 30; config.AddpClientTimeout = 90; //config.AddpTrace = "both"; config.AddpTraceMode = AddpTraceMode.Both; #endregion Endpoint endpoint = new Endpoint("10.220.57.1", 2020); ConfServerProtocol confProtocol = new ConfServerProtocol(endpoint); confProtocol.ClientApplicationType = (int)CfgAppType.CFGSCE; confProtocol.ClientName = "default"; confProtocol.UserName = agent.UserName; confProtocol.UserPassword = agent.Password; try { confProtocol.BeginOpen(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } IConfService confservice = (ConfService)ConfServiceFactory.CreateConfService(confProtocol); CfgPersonQuery query = new CfgPersonQuery(); query.UserName = agent.UserName; CfgPerson person = confservice.RetrieveObject <CfgPerson>(query); //MessageBox.Show(person.ToString()); CfgAccessGroupQuery querys = new CfgAccessGroupQuery(); querys.PersonDbid = person.DBID; querys.TenantDbid = 101; ICollection <CfgAccessGroup> accessGroups = confservice.RetrieveMultipleObjects <CfgAccessGroup>(querys); foreach (CfgAccessGroup accessGroup in accessGroups) { agentProfile = accessGroup.GroupInfo.Name.ToString(); MessageBox.Show(agentProfile); if (agentProfile.Equals("Azf_Nar")) { agentProfile = "Azf_Nar"; MessageBox.Show(agentProfile); break; } else if (agentProfile.Equals("Azf_Fixed")) { agentProfile = "Azf_Fixed"; MessageBox.Show(agentProfile); break; } else if (agentProfile.Equals("Backcell")) { agentProfile = "Backcell"; MessageBox.Show(agentProfile); break; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Creates an instance of <see cref="ApplicationRepo"/> using the provided <paramref name="protocol"/>. /// </summary> /// <param name="protocol">The Config Server Protocol object that will handle requests.</param> /// <returns>An instance of <see cref="ApplicationRepo"/> using the provided <paramref name="protocol"/>.</returns> public override ICtiFeature Create(ConfServerProtocol protocol) => new ApplicationRepo { Protocol = protocol };