protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            UMAutoAttendant umautoAttendant = (UMAutoAttendant)base.PrepareDataObject();

            umautoAttendant.SetId((IConfigurationSession)base.DataSession, base.Name);
            UMDialPlanIdParameter umdialPlan  = this.UMDialPlan;
            UMDialPlan            umdialPlan2 = (UMDialPlan)base.GetDataObject <UMDialPlan>(umdialPlan, this.GetDialPlanSession(), null, new LocalizedString?(Strings.NonExistantDialPlan(umdialPlan.ToString())), new LocalizedString?(Strings.MultipleDialplansWithSameId(umdialPlan.ToString())));

            umautoAttendant.SetDialPlan(umdialPlan2.Id);
            this.dialPlan = umdialPlan2;
            if (base.HasErrors)
            {
                return(null);
            }
            if (base.Fields.IsModified("DTMFFallbackAutoAttendant"))
            {
                UMAutoAttendantIdParameter dtmffallbackAutoAttendant = this.DTMFFallbackAutoAttendant;
                if (dtmffallbackAutoAttendant != null)
                {
                    this.fallbackAA = (UMAutoAttendant)base.GetDataObject <UMAutoAttendant>(dtmffallbackAutoAttendant, base.DataSession, null, new LocalizedString?(Strings.NonExistantAutoAttendant(dtmffallbackAutoAttendant.ToString())), new LocalizedString?(Strings.MultipleAutoAttendantsWithSameId(dtmffallbackAutoAttendant.ToString())));
                    umautoAttendant.DTMFFallbackAutoAttendant = this.fallbackAA.Id;
                }
                else
                {
                    umautoAttendant.DTMFFallbackAutoAttendant = null;
                }
            }
            TaskLogger.LogExit();
            return(umautoAttendant);
        }
示例#2
0
 public static bool DialPlanHasIncompatibleServers(UMDialPlan dialPlan, IConfigurationSession session, Dictionary <Guid, bool> checkedServers)
 {
     if (CommonConstants.UseDataCenterCallRouting)
     {
         return(false);
     }
     if (dialPlan == null || dialPlan.UMServers.Count == 0)
     {
         return(false);
     }
     foreach (ADObjectId adobjectId in dialPlan.UMServers)
     {
         if (!checkedServers.ContainsKey(adobjectId.ObjectGuid))
         {
             Server server = session.Read <Server>(adobjectId);
             if (server != null)
             {
                 checkedServers[adobjectId.ObjectGuid] = true;
                 if (!CommonUtil.IsServerCompatible(server))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
示例#3
0
        protected void SubmitResetPINMessage(string notifyEmail)
        {
            ADUser dataObject = this.DataObject;

            if (string.IsNullOrEmpty(notifyEmail))
            {
                notifyEmail = dataObject.PrimarySmtpAddress.ToString();
            }
            UMMailbox  ummailbox = new UMMailbox(dataObject);
            UMDialPlan dialPlan  = ummailbox.GetDialPlan();

            string[] accessNumbers = null;
            if (dialPlan.AccessTelephoneNumbers != null && dialPlan.AccessTelephoneNumbers.Count > 0)
            {
                accessNumbers = dialPlan.AccessTelephoneNumbers.ToArray();
            }
            string extension = null;

            if (!Utils.TryGetNumericExtension(dialPlan, dataObject, out extension))
            {
                extension = null;
            }
            try
            {
                Utils.SendPasswordResetMail(dataObject, accessNumbers, extension, this.PinInfo.PIN, notifyEmail);
            }
            catch (LocalizedException ex)
            {
                base.WriteError(new RecipientTaskException(Strings.SendPINResetMailError(dataObject.PrimarySmtpAddress.ToString(), ex.LocalizedString), ex), ErrorCategory.NotSpecified, null);
            }
        }
示例#4
0
        protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject)
        {
            if (dataObject == null)
            {
                return(null);
            }
            ADUser aduser = (ADUser)dataObject;

            if (null != aduser.MasterAccountSid)
            {
                aduser.LinkedMasterAccount = SecurityPrincipalIdParameter.GetFriendlyUserName(aduser.MasterAccountSid, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                aduser.ResetChangeTracking();
            }
            UMMailbox ummailbox = UMMailbox.FromDataObject(aduser);

            if (ummailbox.UMDialPlan != null)
            {
                UMDialPlan dialPlan = ummailbox.GetDialPlan();
                if (dialPlan != null && (dialPlan.URIType == UMUriType.E164 || dialPlan.URIType == UMUriType.SipName))
                {
                    ummailbox.SIPResourceIdentifier = UMMailbox.GetPrimaryExtension(ummailbox.EmailAddresses, ProxyAddressPrefix.UM);
                }
                if (dialPlan != null)
                {
                    ummailbox.PhoneNumber = ummailbox.GetEUMPhoneNumber(dialPlan);
                }
                ummailbox.AccessTelephoneNumbers       = dialPlan.AccessTelephoneNumbers;
                ummailbox.CallAnsweringRulesExtensions = new MultiValuedProperty <string>(Utils.GetExtensionsInDialPlanValidForPAA(dialPlan, aduser));
            }
            return(ummailbox);
        }
示例#5
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     if (!base.HasErrors)
     {
         if (this.DataObject.Status == StatusEnum.Disabled)
         {
             AutoAttendantAlreadDisabledException exception = new AutoAttendantAlreadDisabledException(this.DataObject.Name);
             base.WriteError(exception, ErrorCategory.InvalidOperation, null);
         }
         else
         {
             UMDialPlan dialPlan = this.DataObject.GetDialPlan();
             if (dialPlan == null)
             {
                 DialPlanNotFoundException exception2 = new DialPlanNotFoundException(this.DataObject.UMDialPlan.Name);
                 base.WriteError(exception2, ErrorCategory.InvalidOperation, null);
             }
             else
             {
                 ValidationHelper.ValidateDisabledAA(this.ConfigurationSession, dialPlan, this.DataObject);
             }
         }
     }
     TaskLogger.LogExit();
 }
示例#6
0
 // Token: 0x06000C4D RID: 3149 RVA: 0x0004F9AC File Offset: 0x0004DBAC
 private static string[] GetAccessNumbers(UMDialPlan dialPlan)
 {
     string[] result = null;
     if (dialPlan.AccessTelephoneNumbers != null && dialPlan.AccessTelephoneNumbers.Count > 0)
     {
         result = dialPlan.AccessTelephoneNumbers.ToArray();
     }
     return(result);
 }
 protected override void InternalBeginProcessing()
 {
     base.InternalBeginProcessing();
     if (this.UMDialPlan != null)
     {
         UMDialPlan umdialPlan = (UMDialPlan)base.GetDataObject <UMDialPlan>(this.UMDialPlan, this.ConfigurationSession, this.RootId, new LocalizedString?(Strings.NonExistantDialPlan(this.UMDialPlan.ToString())), new LocalizedString?(Strings.MultipleDialplansWithSameId(this.UMDialPlan.ToString())));
         this.dialplanFilter = new ComparisonFilter(ComparisonOperator.Equal, UMAutoAttendantSchema.UMDialPlan, umdialPlan.Id);
     }
 }
        private IConfigurable ValidateDialPlan(IConfigurable configObject)
        {
            UMDialPlan umdialPlan = (UMDialPlan)configObject;

            if (umdialPlan.URIType != UMUriType.SipName)
            {
                this.WriteError(new CannotAddNonSipNameDialplanToCallRouterException(umdialPlan.ToString()), ErrorCategory.InvalidData, umdialPlan, false);
            }
            return(umdialPlan);
        }
示例#9
0
        private IConfigurable ValidateDialPlan(IConfigurable configObject)
        {
            UMDialPlan umdialPlan = (UMDialPlan)configObject;

            if (this.DataObject.VersionNumber >= Server.E15MinVersion && umdialPlan.URIType != UMUriType.SipName)
            {
                base.WriteError(new CannotAddNonSipNameDialplanException(umdialPlan.ToString()), ErrorCategory.InvalidData, umdialPlan);
            }
            return(umdialPlan);
        }
示例#10
0
 internal static void ValidateDisabledAA(IConfigDataProvider dataSession, UMDialPlan dialPlanConfig, UMAutoAttendant disabledAutoAttendant)
 {
     if (dialPlanConfig.ContactScope == CallSomeoneScopeEnum.AutoAttendantLink)
     {
         ADObjectId umautoAttendant = dialPlanConfig.UMAutoAttendant;
         if (umautoAttendant != null && umautoAttendant.ObjectGuid.Equals(disabledAutoAttendant.Guid))
         {
             throw new DefaultAutoAttendantInDialPlanException(dialPlanConfig.Id.ToString());
         }
     }
     ValidationHelper.CheckLinkWithOtherAAsInDialPlan(dataSession, disabledAutoAttendant);
 }
示例#11
0
        public static List <UMServer> GetCompatibleUMRpcServerList(UMDialPlan dialPlan, ITopologyConfigurationSession session)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            ADObjectId localSiteId = null;
            ADObjectId adobjectId  = null;

            try
            {
                Server server = session.FindLocalServer();
                localSiteId = server.ServerSite;
                adobjectId  = server.Id;
            }
            catch (LocalServerNotFoundException)
            {
            }
            Dictionary <ADObjectId, Server> dictionary = new Dictionary <ADObjectId, Server>();

            Utility.FillDictionaryWithCompatibleLocalUMServers(session, dictionary, localSiteId);
            int startIndex = 0;

            if (dictionary.Count == 0)
            {
                Utility.FillDictionaryWithCompatibleUMServers(session, dictionary);
            }
            List <UMServer> list = new List <UMServer>();

            if (dictionary.Count == 0)
            {
                return(list);
            }
            if (adobjectId != null)
            {
                Utility.AddToUMRpcServerList(list, dictionary, adobjectId);
                startIndex = list.Count;
            }
            if (dialPlan != null && dialPlan.UMServers != null && dialPlan.UMServers.Count != 0)
            {
                foreach (ADObjectId serverId in dialPlan.UMServers)
                {
                    Utility.AddToUMRpcServerList(list, dictionary, serverId);
                }
            }
            foreach (Server s in dictionary.Values)
            {
                Utility.AddUMServerToList(list, s);
            }
            dictionary.Clear();
            Utils.Shuffle <UMServer>(list, startIndex);
            return(list);
        }
示例#12
0
 // Token: 0x06000C4C RID: 3148 RVA: 0x0004F914 File Offset: 0x0004DB14
 protected override void InternalDoWork()
 {
     if (base.User.UMEnabled)
     {
         IADSystemConfigurationLookup iadsystemConfigurationLookup = ADSystemConfigurationLookupFactory.CreateFromOrganizationId(base.User.OrganizationId);
         UMDialPlan dialPlanFromId = iadsystemConfigurationLookup.GetDialPlanFromId(base.User.UMRecipientDialPlanId);
         string[]   accessNumbers  = ProvisioningAssistant.PostMigrationUMProvisioningRequest.GetAccessNumbers(dialPlanFromId);
         string     extension      = this.GetExtension(dialPlanFromId);
         Utils.SendWelcomeMail(base.User, accessNumbers, extension, Strings.UnchangedPIN, base.User.PrimarySmtpAddress.ToString(), base.MailboxSession);
         return;
     }
     Utils.ResetUMMailbox(base.User, true, base.MailboxSession);
 }
        public static void OnPostGetObjectForNew(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow    dataRow    = dataTable.Rows[0];
            UMDialPlan umdialPlan = (UMDialPlan)store.GetDataObject("UMDialPlan");

            dataRow["UMDialPlan"]      = umdialPlan.Name;
            dataRow["ExtensionLength"] = umdialPlan.NumberOfDigitsInExtension;
            dataRow["IsTelex"]         = (umdialPlan.URIType == UMUriType.TelExtn);
        }
示例#14
0
        // Token: 0x06000ABF RID: 2751 RVA: 0x00046714 File Offset: 0x00044914
        private bool TryReadUserConfiguration(MailboxInfo mailbox, out ADUser user, out UMDialPlan dialPlan, out bool sendSms, out bool sendMsgWaitingIndicator)
        {
            user     = null;
            dialPlan = null;
            sendSms  = false;
            sendMsgWaitingIndicator = false;
            IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromOrganizationId(mailbox.OrganizationId, null);

            user = (iadrecipientLookup.LookupByExchangeGuid(mailbox.Guid) as ADUser);
            if (user == null)
            {
                ExTraceGlobals.MWITracer.TraceError <Guid>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: Could not find ADUser for mailbox {0}", mailbox.Guid);
                return(false);
            }
            if (!user.UMEnabled || user.UMMailboxPolicy == null || user.UMRecipientDialPlanId == null)
            {
                ExTraceGlobals.MWITracer.TraceError((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: ({0}): Invalid user({1}) UMEnabled({2}) UMMbxPol({3}) DialPlan({4})", new object[]
                {
                    mailbox.Guid,
                    user.DistinguishedName,
                    user.UMEnabled,
                    user.UMMailboxPolicy,
                    user.UMRecipientDialPlanId
                });
                return(false);
            }
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(user.UMMailboxPolicy), 1108, "TryReadUserConfiguration", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\mwi\\MwiAssistant.cs");
            UMMailboxPolicy       ummailboxPolicy = tenantOrTopologyConfigurationSession.Read <UMMailboxPolicy>(user.UMMailboxPolicy);

            if (ummailboxPolicy == null)
            {
                ExTraceGlobals.MWITracer.TraceError <ADObjectId, string>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: Could not find UMMailboxPolicy: {0}, User {1}", user.UMMailboxPolicy, user.DistinguishedName);
                return(false);
            }
            sendSms = ummailboxPolicy.AllowSMSNotification;
            sendMsgWaitingIndicator = ummailboxPolicy.AllowMessageWaitingIndicator;
            ExTraceGlobals.MWITracer.TraceDebug <bool, bool, string>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: AllowSMSNotification={0}, AllowMessageWaitingIndicator={1}, User {2}", sendSms, sendMsgWaitingIndicator, user.DistinguishedName);
            bool flag = sendSms || sendMsgWaitingIndicator;

            if (flag)
            {
                dialPlan = tenantOrTopologyConfigurationSession.Read <UMDialPlan>(user.UMRecipientDialPlanId);
                if (dialPlan == null)
                {
                    ExTraceGlobals.MWITracer.TraceError <ADObjectId>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: Could not find UMDialPlan: {0}", user.UMRecipientDialPlanId);
                    return(false);
                }
                ExTraceGlobals.MWITracer.TraceDebug <string, ADObjectId, UMSubscriberType>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration User {0} DialPlan{1}.SubscriberType={2}.", user.DistinguishedName, dialPlan.Id, dialPlan.SubscriberType);
            }
            return(flag);
        }
示例#15
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            UMMailboxPolicy ummailboxPolicy = (UMMailboxPolicy)base.PrepareDataObject();

            if (!base.HasErrors)
            {
                UMDialPlanIdParameter umdialPlan      = this.UMDialPlan;
                IConfigurationSession dialPlanSession = this.GetDialPlanSession();
                UMDialPlan            umdialPlan2     = (UMDialPlan)base.GetDataObject <UMDialPlan>(umdialPlan, dialPlanSession, null, new LocalizedString?(Strings.NonExistantDialPlan(umdialPlan.ToString())), new LocalizedString?(Strings.MultipleDialplansWithSameId(umdialPlan.ToString())));
                ummailboxPolicy.UMDialPlan = umdialPlan2.Id;
                ummailboxPolicy.SourceForestPolicyNames.Add(ummailboxPolicy.Name);
            }
            return(ummailboxPolicy);
        }
示例#16
0
        private void SetAirSyncNumber(ADUser user)
        {
            UMMailboxPolicy ummailboxPolicy = this.ReadPolicyObject(user);
            UMDialPlan      dialPlan        = ummailboxPolicy.GetDialPlan();
            MultiValuedProperty <string> extensionsFromCollection = UMMailbox.GetExtensionsFromCollection(user.UMAddresses, ProxyAddressPrefix.ASUM, dialPlan.PhoneContext);
            Hashtable     hashtable = new Hashtable();
            List <string> list      = new List <string>();

            foreach (string key in extensionsFromCollection)
            {
                hashtable.Add(key, false);
            }
            foreach (string text in this.AirSyncNumbers)
            {
                if (hashtable.ContainsKey(text))
                {
                    hashtable[text] = true;
                }
                else
                {
                    list.Add(text);
                }
            }
            foreach (object obj in hashtable)
            {
                DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
                if (!(bool)dictionaryEntry.Value)
                {
                    TelephoneNumberProcessStatus status;
                    AirSyncUtils.RemoveAirSyncPhoneNumber(user, (string)dictionaryEntry.Key, out status);
                    ArgumentException ex = this.HandleResult(status, (string)dictionaryEntry.Key);
                    if (ex != null)
                    {
                        base.WriteError(ex, (ErrorCategory)1001, null);
                    }
                }
            }
            foreach (string text2 in list)
            {
                TelephoneNumberProcessStatus status2;
                AirSyncUtils.AddAirSyncPhoneNumber(user, text2, out status2);
                ArgumentException ex2 = this.HandleResult(status2, text2);
                if (ex2 != null)
                {
                    base.WriteError(ex2, (ErrorCategory)1001, null);
                }
            }
        }
示例#17
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.CreateParentContainerIfNeeded(this.DataObject);
            UMDialPlanIdParameter umdialPlan      = this.UMDialPlan;
            IConfigurationSession dialPlanSession = this.GetDialPlanSession();
            UMDialPlan            umdialPlan2     = (UMDialPlan)base.GetDataObject <UMDialPlan>(umdialPlan, dialPlanSession, null, new LocalizedString?(Strings.NonExistantDialPlan(umdialPlan.ToString())), new LocalizedString?(Strings.MultipleDialplansWithSameId(umdialPlan.ToString())));

            if (umdialPlan2.SubscriberType == UMSubscriberType.Consumer)
            {
                this.DataObject.AllowDialPlanSubscribers = false;
                this.DataObject.AllowExtensions          = false;
            }
            base.InternalProcessRecord();
            TaskLogger.LogExit();
        }
示例#18
0
        internal string GetEUMPhoneNumber(UMDialPlan dialPlan)
        {
            Hashtable airSyncSafeTable = UMMailbox.GetAirSyncSafeTable(this.UMAddresses, ProxyAddressPrefix.ASUM, dialPlan);

            foreach (ProxyAddress proxyAddress in this.EmailAddresses)
            {
                if (proxyAddress.Prefix == ProxyAddressPrefix.UM)
                {
                    string phoneContextFromProxyAddress = UMMailbox.GetPhoneContextFromProxyAddress(proxyAddress);
                    if (phoneContextFromProxyAddress == dialPlan.PhoneContext && UMMailbox.IsProxyAddressLocalExtension(proxyAddress) && !airSyncSafeTable.ContainsKey(proxyAddress.AddressString))
                    {
                        return(UMMailbox.GetExtensionFromProxyAddress(proxyAddress));
                    }
                }
            }
            return(null);
        }
示例#19
0
        private void SetPhoneNumber(ADUser user)
        {
            UMMailboxPolicy ummailboxPolicy = this.ReadPolicyObject(user);
            UMDialPlan      dialPlan        = ummailboxPolicy.GetDialPlan();

            if (dialPlan.URIType != UMUriType.E164 || dialPlan.SubscriberType != UMSubscriberType.Consumer)
            {
                base.WriteError(new ArgumentException(Strings.PhoneNumberAllowedOnlyOnE164ConsumerDialplan, "PhoneNumber"), (ErrorCategory)1000, null);
            }
            if (string.IsNullOrEmpty(dialPlan.CountryOrRegionCode))
            {
                base.WriteError(new ArgumentException(Strings.PhoneNumberAllowedOnlyWithDialplanWithCountryCode, "PhoneNumber"), (ErrorCategory)1000, null);
            }
            if (this.PhoneNumber == string.Empty)
            {
                Utils.UMPopulate(user, null, null, ummailboxPolicy, dialPlan);
                return;
            }
            PhoneNumber phoneNumber;

            if (!Microsoft.Exchange.UM.UMCommon.PhoneNumber.TryParse(this.PhoneNumber, out phoneNumber) || phoneNumber.UriType != UMUriType.TelExtn)
            {
                base.WriteError(new ArgumentException(Strings.PhoneNumberNotANumber(dialPlan.NumberOfDigitsInExtension), this.PhoneNumber), (ErrorCategory)1000, null);
            }
            string                       sipResourceIdentifier       = "+" + dialPlan.CountryOrRegionCode + phoneNumber.Number;
            IRecipientSession            tenantLocalRecipientSession = RecipientTaskHelper.GetTenantLocalRecipientSession(user.OrganizationId, base.ExecutingUserOrganizationId, base.RootOrgContainerId);
            LocalizedException           ex = null;
            TelephoneNumberProcessStatus telephoneNumberProcessStatus;

            Utils.ValidateExtensionsAndSipResourceIdentifier(tenantLocalRecipientSession, this.ConfigurationSession, CommonConstants.DataCenterADPresent, user, dialPlan, new string[]
            {
                phoneNumber.Number
            }, new string[]
            {
                this.PhoneNumber
            }, sipResourceIdentifier, out ex, out telephoneNumberProcessStatus);
            if (ex != null)
            {
                base.WriteError(ex, (ErrorCategory)1000, null);
            }
            if (telephoneNumberProcessStatus != TelephoneNumberProcessStatus.PhoneNumberAlreadyRegistered)
            {
                Utils.UMPopulate(user, sipResourceIdentifier, new MultiValuedProperty <string>(phoneNumber.Number), ummailboxPolicy, dialPlan);
            }
        }
示例#20
0
        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;
            }
        }
示例#21
0
 public static void ValidateDtmfFallbackAA(UMAutoAttendant dataObject, UMDialPlan aaDialPlan, UMAutoAttendant dtmfFallbackAA)
 {
     if (dtmfFallbackAA.Guid.Equals(dataObject.Guid))
     {
         throw new InvalidDtmfFallbackAutoAttendantException(Strings.InvalidDtmfFallbackAutoAttendantSelf(dtmfFallbackAA.Identity.ToString()));
     }
     if (!dtmfFallbackAA.UMDialPlan.ObjectGuid.Equals(aaDialPlan.Guid))
     {
         throw new InvalidDtmfFallbackAutoAttendantException(Strings.InvalidDtmfFallbackAutoAttendantDialPlan(dtmfFallbackAA.Identity.ToString()));
     }
     if (dtmfFallbackAA.SpeechEnabled)
     {
         throw new InvalidDtmfFallbackAutoAttendantException(Strings.InvalidDtmfFallbackAutoAttendant(dtmfFallbackAA.Identity.ToString()));
     }
     if (dataObject.SpeechEnabled && dataObject.Status == StatusEnum.Enabled && dtmfFallbackAA.Status == StatusEnum.Disabled)
     {
         throw new InvalidDtmfFallbackAutoAttendantException(Strings.InvalidDtmfFallbackAutoAttendant_Disabled(dtmfFallbackAA.Identity.ToString()));
     }
 }
示例#22
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     if (!base.HasErrors)
     {
         UMDialPlan dialPlan = base.DataObject.GetDialPlan();
         if (dialPlan == null)
         {
             DialPlanNotFoundException exception = new DialPlanNotFoundException(base.DataObject.UMDialPlan.Name);
             base.WriteError(exception, ErrorCategory.InvalidOperation, null);
         }
         else
         {
             ValidationHelper.ValidateDisabledAA(this.ConfigurationSession, dialPlan, base.DataObject);
         }
     }
     TaskLogger.LogExit();
 }
示例#23
0
        public static List <UMServer> GetCompatibleUMRpcServers(ADObjectId site, UMDialPlan dialPlan, ITopologyConfigurationSession session)
        {
            List <UMServer> list = new List <UMServer>();

            if (CommonConstants.UseDataCenterCallRouting)
            {
                QueryFilter filter = new AndFilter(new QueryFilter[]
                {
                    CommonUtil.GetCompatibleServersWithRole(VersionEnum.Compatible, ServerRole.UnifiedMessaging),
                    new ComparisonFilter(ComparisonOperator.Equal, ServerSchema.ServerSite, site)
                });
                IEnumerable <Server> enumerable = session.FindPaged <Server>(null, QueryScope.SubTree, filter, null, 0);
                foreach (Server dataObject in enumerable)
                {
                    list.Add(new UMServer(dataObject));
                }
                return(list);
            }
            return(Utility.GetCompatibleUMRpcServerList(dialPlan, session));
        }
示例#24
0
        private void CreateHuntgroup(UMDialPlan dp)
        {
            UMHuntGroup umhuntGroup = new UMHuntGroup();

            umhuntGroup.UMDialPlan = dp.Id;
            AdName     adName       = new AdName("CN", Strings.DefaultUMHuntGroupName.ToString());
            ADObjectId descendantId = this.DataObject.Id.GetDescendantId(new ADObjectId(adName.ToString(), Guid.Empty));

            base.WriteVerbose(Strings.AttemptingToCreateHuntgroup);
            umhuntGroup.SetId(descendantId);
            if (base.CurrentOrganizationId != null)
            {
                umhuntGroup.OrganizationId = base.CurrentOrganizationId;
            }
            else
            {
                umhuntGroup.OrganizationId = base.ExecutingUserOrganizationId;
            }
            base.DataSession.Save(umhuntGroup);
        }
        public static void OnPostGetObject(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0 || store == null)
            {
                return;
            }
            DataRow         dataRow         = dataTable.Rows[0];
            UMAutoAttendant umautoAttendant = (UMAutoAttendant)store.GetDataObject("UMAutoAttendant");

            if (umautoAttendant != null)
            {
                UMDialPlan dialPlan = umautoAttendant.GetDialPlan();
                dataRow["ExtensionLength"] = dialPlan.NumberOfDigitsInExtension;
                dataRow["IsTelex"]         = (dialPlan.URIType == UMUriType.TelExtn);
                List <UMAAMenuKeyMapping> value;
                List <UMAAMenuKeyMapping> value2;
                UMAAMenuKeyMapping.CreateMappings((MultiValuedProperty <CustomMenuKeyMapping>)dataRow["BusinessHoursKeyMapping"], (MultiValuedProperty <CustomMenuKeyMapping>)dataRow["AfterHoursKeyMapping"], out value, out value2);
                dataRow["BusinessHoursKeyMapping"] = value;
                dataRow["AfterHoursKeyMapping"]    = value2;
                dataRow["BusinessHoursSchedule"]   = new ScheduleBuilder(new Schedule(umautoAttendant.BusinessHoursSchedule)).GetEntireState();
            }
        }
示例#26
0
            // Token: 0x06000C4E RID: 3150 RVA: 0x0004F9E0 File Offset: 0x0004DBE0
            private string GetExtension(UMDialPlan dialPlan)
            {
                string result = string.Empty;

                if (dialPlan.URIType == UMUriType.TelExtn)
                {
                    result = base.User.UMExtension;
                }
                else
                {
                    foreach (string text in base.User.Extensions)
                    {
                        PhoneNumber phoneNumber;
                        if (PhoneNumber.TryParse(text, out phoneNumber) && phoneNumber.UriType == UMUriType.TelExtn)
                        {
                            result = text;
                            break;
                        }
                    }
                }
                return(result);
            }
示例#27
0
        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);
        }
示例#28
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     if (!base.HasErrors)
     {
         UMDialPlan dialPlan = this.DataObject.GetDialPlan();
         if (dialPlan == null)
         {
             base.WriteError(new DialPlanNotFoundException(this.DataObject.UMDialPlan.Name), ErrorCategory.NotSpecified, null);
         }
         int numberOfDigitsInExtension = dialPlan.NumberOfDigitsInExtension;
         MultiValuedProperty <string> multiValuedProperty = null;
         multiValuedProperty = this.DataObject.PilotIdentifierList;
         if (this.DataObject.IsChanged(UMAutoAttendantSchema.PilotIdentifierList) && multiValuedProperty != null)
         {
             LocalizedException ex = ValidationHelper.ValidateDialedNumbers(this.DataObject.PilotIdentifierList, dialPlan);
             if (ex != null)
             {
                 base.WriteError(ex, ErrorCategory.NotSpecified, this.DataObject);
             }
             foreach (string text in this.DataObject.PilotIdentifierList)
             {
                 UMAutoAttendant umautoAttendant = UMAutoAttendant.FindAutoAttendantByPilotIdentifierAndDialPlan(text, this.DataObject.UMDialPlan);
                 if (umautoAttendant != null && !umautoAttendant.Guid.Equals(this.DataObject.Guid))
                 {
                     base.WriteError(new AutoAttendantExistsException(text, this.DataObject.UMDialPlan.Name), ErrorCategory.NotSpecified, null);
                 }
             }
             if (dialPlan.URIType == UMUriType.SipName)
             {
                 Utility.CheckForPilotIdentifierDuplicates(this.DataObject, this.ConfigurationSession, multiValuedProperty, new Task.TaskErrorLoggingDelegate(base.WriteError));
             }
         }
         string timeZone = this.DataObject.TimeZone;
         if (this.DataObject.IsChanged(UMAutoAttendantSchema.BusinessHourFeatures))
         {
             ValidationHelper.ValidateTimeZone(timeZone);
         }
         string property;
         try
         {
             property = UMAutoAttendantSchema.BusinessHoursKeyMapping.ToString();
             MultiValuedProperty <CustomMenuKeyMapping> multiValuedProperty2 = this.DataObject.BusinessHoursKeyMapping;
             if (multiValuedProperty2 != null && multiValuedProperty2.Count > 0)
             {
                 bool flag;
                 ValidationHelper.ValidateCustomMenu(Strings.BusinessHoursSettings, this.ConfigurationSession, property, multiValuedProperty2, numberOfDigitsInExtension, this.DataObject, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADRecipient>), out flag);
                 if (flag)
                 {
                     this.DataObject.BusinessHoursKeyMapping = multiValuedProperty2;
                 }
             }
             property             = UMAutoAttendantSchema.AfterHoursKeyMapping.ToString();
             multiValuedProperty2 = this.DataObject.AfterHoursKeyMapping;
             if (multiValuedProperty2 != null && multiValuedProperty2.Count > 0)
             {
                 bool flag2;
                 ValidationHelper.ValidateCustomMenu(Strings.AfterHoursSettings, this.ConfigurationSession, property, multiValuedProperty2, numberOfDigitsInExtension, this.DataObject, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADRecipient>), out flag2);
                 if (flag2)
                 {
                     this.DataObject.AfterHoursKeyMapping = multiValuedProperty2;
                 }
             }
         }
         catch (LocalizedException exception)
         {
             base.WriteError(exception, ErrorCategory.NotSpecified, null);
         }
         bool       speechEnabled = this.DataObject.SpeechEnabled;
         StatusEnum status        = this.DataObject.Status;
         property = UMAutoAttendantSchema.DTMFFallbackAutoAttendant.ToString();
         if (this.fallbackAA != null)
         {
             ValidationHelper.ValidateDtmfFallbackAA(this.DataObject, dialPlan, this.fallbackAA);
         }
         ADObjectId adobjectId = null;
         property = UMAutoAttendantSchema.AutomaticSpeechRecognitionEnabled.ToString();
         if (this.DataObject.IsChanged(UMAutoAttendantSchema.AutomaticSpeechRecognitionEnabled) && speechEnabled && ValidationHelper.IsFallbackAAInDialPlan(this.ConfigurationSession, this.DataObject, out adobjectId))
         {
             base.WriteError(new InvalidDtmfFallbackAutoAttendantException(Strings.InvalidSpeechEnabledAutoAttendant(adobjectId.ToString())), ErrorCategory.NotSpecified, null);
         }
         property = UMAutoAttendantSchema.Language.ToString();
         if (this.DataObject.IsChanged(UMAutoAttendantSchema.Language))
         {
             UMLanguage language = this.DataObject.Language;
             if (!Utility.IsUMLanguageAvailable(language))
             {
                 base.WriteError(new InvalidLanguageIdException(language.ToString()), ErrorCategory.NotSpecified, null);
             }
         }
         bool flag3 = this.IsBusinessHours();
         if (!this.DataObject.NameLookupEnabled && !this.DataObject.CallSomeoneEnabled && ((flag3 && !this.DataObject.BusinessHoursTransferToOperatorEnabled && !this.DataObject.BusinessHoursKeyMappingEnabled) || (!flag3 && !this.DataObject.AfterHoursTransferToOperatorEnabled && !this.DataObject.AfterHoursKeyMappingEnabled)))
         {
             base.WriteError(new InvalidAutoAttendantException(Strings.InvalidMethodToDisableAA), ErrorCategory.NotSpecified, null);
         }
         LocalizedString empty = LocalizedString.Empty;
         if (!DialGroupEntry.ValidateGroup(dialPlan.ConfiguredInCountryOrRegionGroups, this.DataObject.AllowedInCountryOrRegionGroups, true, out empty))
         {
             base.WriteError(new Exception(empty), ErrorCategory.WriteError, this.DataObject);
         }
         if (!DialGroupEntry.ValidateGroup(dialPlan.ConfiguredInternationalGroups, this.DataObject.AllowedInternationalGroups, false, out empty))
         {
             base.WriteError(new Exception(empty), ErrorCategory.WriteError, this.DataObject);
         }
         if (this.DataObject.ForwardCallsToDefaultMailbox && string.IsNullOrEmpty(this.DataObject.DefaultMailboxLegacyDN))
         {
             base.WriteError(new InvalidParameterException(Strings.DefaultMailboxRequiredWhenForwardTrue), ErrorCategory.NotSpecified, null);
         }
         if (this.DataObject.IsModified(UMAutoAttendantSchema.ContactScope) && this.DataObject.ContactScope == DialScopeEnum.DialPlan && dialPlan.SubscriberType == UMSubscriberType.Consumer)
         {
             base.WriteError(new InvalidParameterException(Strings.InvalidAutoAttendantScopeSetting), (ErrorCategory)1000, null);
         }
     }
     TaskLogger.LogExit();
 }
示例#29
0
        internal static Hashtable GetAirSyncSafeTable(ProxyAddressCollection collection, ProxyAddressPrefix prefix, UMDialPlan dialPlan)
        {
            Hashtable hashtable = new Hashtable();

            foreach (ProxyAddress proxyAddress in collection)
            {
                if (proxyAddress.Prefix == prefix)
                {
                    hashtable.Add(proxyAddress.AddressString, true);
                    hashtable.Add(proxyAddress.AddressString.Substring(dialPlan.CountryOrRegionCode.Length + 1), true);
                }
            }
            return(hashtable);
        }
示例#30
0
        internal static void RemoveProxy(ADRecipient recipient, ProxyAddressCollection collection, ProxyAddressPrefix prefix, ArrayList phoneNumbers, UMDialPlan dialPlan)
        {
            Hashtable hashtable = new Hashtable();

            foreach (object obj in phoneNumbers)
            {
                string extension = (string)obj;
                hashtable.Add(UMMailbox.BuildAddressStringFromExtensionAndPhoneContext(extension, dialPlan.PhoneContext), true);
            }
            UMMailbox.RemoveProxy(recipient, collection, prefix, hashtable);
        }