private void AddCallerId(PersonalAutoAttendant paa)
        {
            PAACallerIdInfo paacallerIdInfo = (PAACallerIdInfo)base.GetParameter("CllrId");

            if (paacallerIdInfo == null)
            {
                return;
            }
            if (paacallerIdInfo.HasPhoneNumbers)
            {
                string[] array = (string[])base.GetParameter("CPh");
                foreach (string phoneNumber in array)
                {
                    paa.CallerIdList.Add(CallerIdBase.CreatePhoneNumber(phoneNumber));
                }
            }
            if (paacallerIdInfo.HasContacts)
            {
                RecipientInfo[] array3 = (RecipientInfo[])base.GetParameter("CRcps");
                foreach (RecipientInfo recipientInfo in array3)
                {
                    CallerIdBase item = null;
                    if (recipientInfo.AddressOrigin == AddressOrigin.Store)
                    {
                        item = CallerIdBase.CreateContactItem(recipientInfo.StoreObjectId);
                    }
                    else if (recipientInfo.AddressOrigin == AddressOrigin.Directory)
                    {
                        item = new ADContactCallerId(recipientInfo.RoutingAddress);
                    }
                    paa.CallerIdList.Add(item);
                }
            }
            if (paacallerIdInfo.IsInContactFolder)
            {
                paa.CallerIdList.Add(new ContactFolderCallerId());
            }
        }
        public void ValidateCallerId()
        {
            PAACallerIdInfo paacallerIdInfo = (PAACallerIdInfo)base.GetParameter("CllrId");
            string          text            = null;

            using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
            {
                if (paacallerIdInfo.HasPhoneNumbers)
                {
                    string[] array = (string[])base.GetParameter("CPh");
                    if (array.Length > 50)
                    {
                        text = Utilities.HtmlEncode(string.Format(CultureInfo.CurrentCulture, LocalizedStrings.GetNonEncoded(1755659442), new object[]
                        {
                            50
                        }));
                    }
                    if (text == null)
                    {
                        text = UnifiedMessagingUtilities.ValidatePhoneNumbers(new UnifiedMessagingUtilities.ValidatePhoneNumber(ipaastore.ValidatePhoneNumberCallerId), array);
                    }
                }
                IDataValidationResult dataValidationResult = null;
                if (text == null && paacallerIdInfo.HasContacts)
                {
                    RecipientInfo[] array2 = (RecipientInfo[])base.GetParameter("CRcps");
                    if (array2.Length > 50)
                    {
                        text = Utilities.HtmlEncode(string.Format(CultureInfo.CurrentCulture, LocalizedStrings.GetNonEncoded(2034140420), new object[]
                        {
                            50
                        }));
                    }
                    if (text == null)
                    {
                        foreach (RecipientInfo recipientInfo in array2)
                        {
                            if (recipientInfo.AddressOrigin == AddressOrigin.Store)
                            {
                                ipaastore.ValidateContactItemCallerId(recipientInfo.StoreObjectId, out dataValidationResult);
                            }
                            else if (recipientInfo.AddressOrigin == AddressOrigin.Directory)
                            {
                                ipaastore.ValidateADContactCallerId(recipientInfo.RoutingAddress, out dataValidationResult);
                            }
                            if (dataValidationResult.PAAValidationResult != PAAValidationResult.Valid)
                            {
                                text = UnifiedMessagingUtilities.GetErrorResourceId(dataValidationResult.PAAValidationResult, recipientInfo.DisplayName);
                                break;
                            }
                        }
                    }
                }
                if (text == null && paacallerIdInfo.IsInContactFolder)
                {
                    ipaastore.ValidateContactFolderCallerId(out dataValidationResult);
                    if (dataValidationResult.PAAValidationResult != PAAValidationResult.Valid)
                    {
                        text = UnifiedMessagingUtilities.GetErrorResourceId(dataValidationResult.PAAValidationResult, null);
                    }
                }
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.RenderErrorInfobar(text);
            }
        }