protected void ValidateCommonParamsAndSetOrg(UMDialPlanIdParameter dpParam, UMIPGatewayIdParameter gwParam, out Guid dpGuid, out Guid gwGuid, out string dpName, out string gwName) { dpGuid = Guid.Empty; gwGuid = Guid.Empty; dpName = string.Empty; gwName = string.Empty; if (dpParam == null && gwParam == null) { return; } IConfigurationSession session = this.CreateSessionToResolveConfigObjects(false); OrganizationId organizationId = null; if (dpParam != null) { UMDialPlan umdialPlan = (UMDialPlan)base.GetDataObject <UMDialPlan>(dpParam, session, null, new LocalizedString?(Strings.NonExistantDialPlan(dpParam.ToString())), new LocalizedString?(Strings.MultipleDialplansWithSameId(dpParam.ToString()))); dpGuid = umdialPlan.Guid; dpName = umdialPlan.Name; organizationId = umdialPlan.OrganizationId; } if (gwParam != null) { UMIPGateway umipgateway = (UMIPGateway)base.GetDataObject <UMIPGateway>(gwParam, session, null, new LocalizedString?(Strings.NonExistantIPGateway(gwParam.ToString())), new LocalizedString?(Strings.MultipleIPGatewaysWithSameId(gwParam.ToString()))); gwGuid = umipgateway.Guid; gwName = umipgateway.Name; if (organizationId != null && !organizationId.Equals(umipgateway.OrganizationId)) { base.WriteError(new InvalidParameterException(Strings.MismatchedOrgInDPAndGW(dpParam.ToString(), gwParam.ToString())), ErrorCategory.InvalidArgument, null); } else { organizationId = umipgateway.OrganizationId; } } if (this.Organization != null) { organizationId != null; } if (organizationId != null) { base.CurrentOrganizationId = organizationId; } }
protected override IConfigurable PrepareDataObject() { TaskLogger.LogEnter(); UMHuntGroup umhuntGroup = (UMHuntGroup)base.PrepareDataObject(); IConfigurationSession session = (IConfigurationSession)base.DataSession; UMDialPlanIdParameter umdialPlan = this.UMDialPlan; UMDialPlan umdialPlan2 = (UMDialPlan)base.GetDataObject <UMDialPlan>(umdialPlan, session, this.RootId, new LocalizedString?(Strings.NonExistantDialPlan(umdialPlan.ToString())), new LocalizedString?(Strings.MultipleDialplansWithSameId(umdialPlan.ToString()))); umhuntGroup.UMDialPlan = umdialPlan2.Id; if (umdialPlan2.URIType == UMUriType.SipName && !VariantConfiguration.InvariantNoFlightingSnapshot.UM.HuntGroupCreationForSipDialplans.Enabled) { base.WriteError(new CannotCreateHuntGroupForHostedSipDialPlanException(), ErrorCategory.InvalidOperation, umhuntGroup); } UMIPGatewayIdParameter umipgateway = this.UMIPGateway; UMIPGateway umipgateway2 = (UMIPGateway)base.GetDataObject <UMIPGateway>(umipgateway, session, this.RootId, new LocalizedString?(Strings.NonExistantIPGateway(umipgateway.ToString())), new LocalizedString?(Strings.MultipleIPGatewaysWithSameId(umipgateway.ToString()))); bool flag = false; foreach (UMHuntGroup umhuntGroup2 in umipgateway2.HuntGroups) { if (umhuntGroup2.PilotIdentifier == umhuntGroup.PilotIdentifier) { flag = true; break; } } if (flag) { HuntGroupAlreadyExistsException exception = new HuntGroupAlreadyExistsException(umipgateway2.Name, umhuntGroup.PilotIdentifier); base.WriteError(exception, ErrorCategory.InvalidArgument, null); } else { umhuntGroup.SetId(umipgateway2.Id.GetChildId(base.Name)); } TaskLogger.LogExit(); return(umhuntGroup); }
protected override void InternalValidate() { Dictionary <Guid, bool> dictionary = new Dictionary <Guid, bool>(); TaskLogger.LogEnter(); base.InternalValidate(); if (!base.HasErrors) { this.rootOrgConfigSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 123, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\um\\GetUMActiveCalls.cs"); if (this.DialPlan != null) { IEnumerable <UMDialPlan> objects = this.DialPlan.GetObjects <UMDialPlan>(null, this.rootOrgConfigSession); using (IEnumerator <UMDialPlan> enumerator = objects.GetEnumerator()) { if (!enumerator.MoveNext()) { base.WriteError(new LocalizedException(Strings.NonExistantDialPlan(this.DialPlan.ToString())), ErrorCategory.InvalidData, this.DialPlan); } this.adResults = enumerator.Current; if (enumerator.MoveNext()) { base.WriteError(new LocalizedException(Strings.MultipleDialplansWithSameId(this.DialPlan.ToString())), ErrorCategory.InvalidData, this.DialPlan); } } UMDialPlan dialPlan = (UMDialPlan)this.adResults; if (Utility.DialPlanHasIncompatibleServers(dialPlan, this.rootOrgConfigSession, dictionary)) { this.WriteWarning(Strings.InvalidServerVersionInDialPlan(((UMDialPlan)this.adResults).Name)); } } else { if (this.IPGateway != null) { IEnumerable <UMIPGateway> objects2 = this.IPGateway.GetObjects <UMIPGateway>(null, this.rootOrgConfigSession); using (IEnumerator <UMIPGateway> enumerator2 = objects2.GetEnumerator()) { if (!enumerator2.MoveNext()) { base.WriteError(new LocalizedException(Strings.NonExistantIPGateway(this.IPGateway.ToString())), ErrorCategory.InvalidData, this.IPGateway); } this.adResults = enumerator2.Current; if (enumerator2.MoveNext()) { base.WriteError(new LocalizedException(Strings.MultipleIPGatewaysWithSameId(this.IPGateway.ToString())), ErrorCategory.InvalidData, this.IPGateway); } } if (CommonConstants.UseDataCenterCallRouting) { goto IL_36F; } UMIPGateway umipgateway = (UMIPGateway)this.adResults; using (MultiValuedProperty <UMHuntGroup> .Enumerator enumerator3 = umipgateway.HuntGroups.GetEnumerator()) { while (enumerator3.MoveNext()) { UMHuntGroup umhuntGroup = enumerator3.Current; if (umhuntGroup.UMDialPlan != null && !dictionary.ContainsKey(umhuntGroup.UMDialPlan.ObjectGuid)) { dictionary[umhuntGroup.UMDialPlan.ObjectGuid] = true; IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.FullyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(umhuntGroup.UMDialPlan), 189, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\um\\GetUMActiveCalls.cs"); UMDialPlan dialPlan2 = tenantOrTopologyConfigurationSession.Read <UMDialPlan>(umhuntGroup.UMDialPlan); if (Utility.DialPlanHasIncompatibleServers(dialPlan2, this.rootOrgConfigSession, dictionary)) { this.WriteWarning(Strings.InvalidServerVersionInGateway(umipgateway.Name)); } } } goto IL_36F; } } if (this.Server != null) { IEnumerable <Server> objects3 = this.Server.GetObjects <Server>(null, this.rootOrgConfigSession); using (IEnumerator <Server> enumerator4 = objects3.GetEnumerator()) { if (!enumerator4.MoveNext()) { base.WriteError(new LocalizedException(Strings.NonExistantServer(this.Server.ToString())), ErrorCategory.InvalidData, this.Server); } this.adResults = enumerator4.Current; if (enumerator4.MoveNext()) { base.WriteError(new LocalizedException(Strings.MultipleServersWithSameId(this.Server.ToString())), ErrorCategory.InvalidData, this.Server); } } Server target = (Server)this.adResults; this.ValidateServerIsCompatible(target); } else if (this.InstanceServer != null) { Server target2 = (Server)this.InstanceServer.DataObject; this.ValidateServerIsCompatible(target2); } } } IL_36F: TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { string serverName = string.Empty; try { TaskLogger.LogEnter(); if (this.IPGateway != null) { UMIPGateway umipgateway = (UMIPGateway)this.adResults; List <UMServer> compatibleUMRpcServerList = Utility.GetCompatibleUMRpcServerList(null, this.rootOrgConfigSession); using (List <UMServer> .Enumerator enumerator = compatibleUMRpcServerList.GetEnumerator()) { while (enumerator.MoveNext()) { UMServer umserver = enumerator.Current; serverName = umserver.Name; ActiveCalls[] dataObjects = this.InvokeGetActiveCalls(serverName, null, umipgateway.Address.ToString()); this.WriteResults(dataObjects); } goto IL_175; } } if (this.DialPlan != null) { UMDialPlan umdialPlan = (UMDialPlan)this.adResults; List <UMServer> compatibleUMRpcServerList2 = Utility.GetCompatibleUMRpcServerList(umdialPlan, this.rootOrgConfigSession); using (List <UMServer> .Enumerator enumerator2 = compatibleUMRpcServerList2.GetEnumerator()) { while (enumerator2.MoveNext()) { UMServer umserver2 = enumerator2.Current; serverName = umserver2.Name; ActiveCalls[] dataObjects2 = this.InvokeGetActiveCalls(serverName, umdialPlan.Name, null); this.WriteResults(dataObjects2); } goto IL_175; } } if (this.Server != null) { Server server = (Server)this.adResults; serverName = server.Name; ActiveCalls[] dataObjects3 = this.InvokeGetActiveCalls(serverName, null, null); this.WriteResults(dataObjects3); } else if (this.InstanceServer != null) { serverName = this.InstanceServer.Name; ActiveCalls[] dataObjects4 = this.InvokeGetActiveCalls(serverName, null, null); this.WriteResults(dataObjects4); } else { serverName = "localhost"; ActiveCalls[] dataObjects5 = this.InvokeGetActiveCalls(serverName, null, null); this.WriteResults(dataObjects5); } IL_175: TaskLogger.LogExit(); } catch (RpcException e) { this.WriteRpcError(e, serverName); } }