Ejemplo n.º 1
0
 public void Refresh()
 {
     using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
     {
         IList <PersonalAutoAttendant> personalAutoAttendants = null;
         ipaastore.TryGetAutoAttendants(PAAValidationMode.StopOnFirstError, out personalAutoAttendants);
         this.RefreshList(personalAutoAttendants);
     }
 }
 protected void RenderPersonalAutoAttendantList()
 {
     using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
     {
         IList <PersonalAutoAttendant> personalAutoAttendants = null;
         ipaastore.TryGetAutoAttendants(PAAValidationMode.StopOnFirstError, out personalAutoAttendants);
         PersonalAutoAttendantListView personalAutoAttendantListView = new PersonalAutoAttendantListView(base.UserContext, personalAutoAttendants);
         personalAutoAttendantListView.Render(base.Response.Output);
     }
 }
Ejemplo n.º 3
0
 public void Delete()
 {
     using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
     {
         Guid identity = new Guid(Convert.FromBase64String((string)base.GetParameter("Id")));
         PersonalAutoAttendant personalAutoAttendant = null;
         ipaastore.TryGetAutoAttendant(identity, PAAValidationMode.None, out personalAutoAttendant);
         if (personalAutoAttendant != null)
         {
             ipaastore.DeleteAutoAttendant(identity);
         }
         IList <PersonalAutoAttendant> personalAutoAttendants = null;
         ipaastore.TryGetAutoAttendants(PAAValidationMode.StopOnFirstError, out personalAutoAttendants);
         this.RefreshList(personalAutoAttendants);
     }
 }
Ejemplo n.º 4
0
 public void Move()
 {
     using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
     {
         IList <PersonalAutoAttendant> list = null;
         ipaastore.TryGetAutoAttendants(PAAValidationMode.StopOnFirstError, out list);
         Guid identity = new Guid(Convert.FromBase64String((string)base.GetParameter("Id")));
         int  num;
         PersonalAutoAttendant personalAutoAttendant = PersonalAutoAttendantOptionsEventHandler.FindAutoAttendantByGuid(list, identity, out num);
         if (personalAutoAttendant != null)
         {
             if (this.IsOrderChanged(list))
             {
                 base.RenderPartialFailure(-846213614, OwaEventHandlerErrorCode.UnexpectedError);
             }
             else
             {
                 int num2 = (int)base.GetParameter("op");
                 if ((num2 != 1 || num == 0) && (num2 != 2 || num >= list.Count - 1))
                 {
                     throw new OwaInvalidRequestException("Event name and parameter doesn't match");
                 }
                 list.RemoveAt(num);
                 if (num2 == 1)
                 {
                     list.Insert(num - 1, personalAutoAttendant);
                 }
                 else
                 {
                     list.Insert(num + 1, personalAutoAttendant);
                 }
                 ipaastore.Save(list);
                 ipaastore.TryGetAutoAttendants(PAAValidationMode.StopOnFirstError, out list);
             }
         }
         else
         {
             base.RenderPartialFailure(-289549140, OwaEventHandlerErrorCode.ItemNotFound);
         }
         this.RefreshList(list);
     }
 }
Ejemplo n.º 5
0
 private void ValidateParameters()
 {
     if (this.CallAnsweringRuleId != null)
     {
         using (UMSubscriber umsubscriber = UMRecipient.Factory.FromADRecipient <UMSubscriber>(this.adUser))
         {
             if (umsubscriber != null)
             {
                 using (IPAAStore ipaastore = PAAStore.Create(umsubscriber))
                 {
                     if (ipaastore.GetAutoAttendant(this.CallAnsweringRuleId.RawRuleGuid.Value, PAAValidationMode.None) == null)
                     {
                         base.WriteError(new CallAnsweringRuleNotFoundException(this.CallAnsweringRuleId.RawRuleGuid.Value.ToString()), ErrorCategory.InvalidArgument, null);
                     }
                     goto IL_99;
                 }
             }
             base.WriteError(new UserNotUmEnabledException(this.adUser.Id.ToString()), (ErrorCategory)1000, null);
             IL_99:;
         }
     }
 }
Ejemplo n.º 6
0
 public void Enable()
 {
     using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
     {
         IList <PersonalAutoAttendant> list = null;
         ipaastore.TryGetAutoAttendants(PAAValidationMode.StopOnFirstError, out list);
         Guid identity = new Guid(Convert.FromBase64String((string)base.GetParameter("Id")));
         int  index;
         PersonalAutoAttendant personalAutoAttendant = PersonalAutoAttendantOptionsEventHandler.FindAutoAttendantByGuid(list, identity, out index);
         if (personalAutoAttendant != null)
         {
             int num = (int)base.GetParameter("op");
             if (num == 3)
             {
                 personalAutoAttendant.Enabled = true;
             }
             else
             {
                 if (num != 4)
                 {
                     throw new OwaInvalidRequestException("Event name and parameter doesn't match");
                 }
                 personalAutoAttendant.Enabled = false;
             }
             ipaastore.Save(list);
             ipaastore.TryGetAutoAttendants(PAAValidationMode.StopOnFirstError, out list);
             personalAutoAttendant = list[index];
             this.Writer.Write("<div id=\"ret\" enbl=");
             this.Writer.Write(personalAutoAttendant.Enabled ? 1 : 0);
             this.Writer.Write("></div>");
         }
         else
         {
             base.RenderPartialFailure(-289549140, OwaEventHandlerErrorCode.ItemNotFound);
             this.RefreshList(list);
         }
     }
 }
Ejemplo n.º 7
0
        public void ValidateFindMe()
        {
            PAAFindMeInfo paafindMeInfo = (PAAFindMeInfo)base.GetParameter("FndMe");
            string        text          = null;

            using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
            {
                List <string> list = new List <string>();
                if (!string.IsNullOrEmpty(paafindMeInfo.Ph1))
                {
                    list.Add(paafindMeInfo.Ph1);
                }
                if (!string.IsNullOrEmpty(paafindMeInfo.Ph2))
                {
                    list.Add(paafindMeInfo.Ph2);
                }
                text = UnifiedMessagingUtilities.ValidatePhoneNumbers(new UnifiedMessagingUtilities.ValidatePhoneNumber(ipaastore.ValidatePhoneNumberForOutdialing), list.ToArray());
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.RenderErrorInfobar(text);
            }
        }
Ejemplo n.º 8
0
        public void ValidateTransferTo()
        {
            PAATransferToInfo paatransferToInfo = (PAATransferToInfo)base.GetParameter("XfrTo");
            string            text = null;

            using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
            {
                if (!string.IsNullOrEmpty(paatransferToInfo.Ph))
                {
                    text = UnifiedMessagingUtilities.ValidatePhoneNumbers(new UnifiedMessagingUtilities.ValidatePhoneNumber(ipaastore.ValidatePhoneNumberForOutdialing), new string[]
                    {
                        paatransferToInfo.Ph
                    });
                }
                else
                {
                    IDataValidationResult dataValidationResult = null;
                    if (paatransferToInfo.VM)
                    {
                        ipaastore.ValidateADContactForTransferToMailbox(paatransferToInfo.Contact, out dataValidationResult);
                    }
                    else
                    {
                        ipaastore.ValidateADContactForOutdialing(paatransferToInfo.Contact, out dataValidationResult);
                    }
                    if (dataValidationResult.PAAValidationResult != PAAValidationResult.Valid)
                    {
                        text = UnifiedMessagingUtilities.GetErrorResourceId(dataValidationResult.PAAValidationResult, paatransferToInfo.Contact);
                    }
                }
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.RenderErrorInfobar(text);
            }
        }
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     this.infobar = new Infobar();
     using (UMClientCommon umclientCommon = new UMClientCommon(base.UserContext.ExchangePrincipal))
     {
         if (!umclientCommon.IsUMEnabled())
         {
             throw new OwaInvalidRequestException("User is not UM enabled");
         }
         this.isPlayOnPhoneEnabled             = umclientCommon.IsPlayOnPhoneEnabled();
         this.enabledForPinlessVoicemail       = umclientCommon.UMPolicy.AllowPinlessVoiceMailAccess;
         this.enabledForSMSNotification        = umclientCommon.IsSmsNotificationsEnabled();
         this.enabledForVoicemailPreview       = umclientCommon.UMPolicy.AllowVoiceMailPreview;
         this.enabledForMissedCallNotification = umclientCommon.UMPolicy.AllowMissedCallNotifications;
         this.isDialPlanEnterprise             = (umclientCommon.DialPlan.SubscriberType == UMSubscriberType.Enterprise);
         UMPropertiesEx umproperties = umclientCommon.GetUMProperties();
         this.isOutOfOffice             = umproperties.OofStatus;
         this.isFIFOOrder               = umproperties.ReadUnreadVoicemailInFIFOOrder;
         this.isMissedCallNotification  = umproperties.MissedCallNotificationEnabled;
         this.dialOnPhoneNumber         = umproperties.PlayOnPhoneDialString;
         this.telephoneAccessNumbers    = umproperties.TelephoneAccessNumbers;
         this.isPinlessVoicemail        = umproperties.PinlessAccessToVoicemail;
         this.smsNotificationValue      = umproperties.SMSNotificationOption;
         this.isVoicemailPreviewReceive = umproperties.ReceivedVoiceMailPreviewEnabled;
         this.isVoicemailPreviewSend    = umproperties.SentVoiceMailPreviewEnabled;
         try
         {
             this.telephoneFolderId = StoreObjectId.FromProviderSpecificId(Convert.FromBase64String(umproperties.TelephoneAccessFolderEmail));
         }
         catch (CorruptDataException arg)
         {
             ExTraceGlobals.CoreCallTracer.TraceDebug <string, CorruptDataException>(0L, "Invalid format for Folder ID string: {0}. Exception: {1}", umproperties.TelephoneAccessFolderEmail, arg);
         }
         catch (FormatException arg2)
         {
             ExTraceGlobals.CoreCallTracer.TraceDebug <string, FormatException>(0L, "Invalid format for Folder ID string: {0}. Exception: {1}", umproperties.TelephoneAccessFolderEmail, arg2);
         }
     }
     if (this.telephoneFolderId == null)
     {
         this.telephoneFolderId = base.UserContext.InboxFolderId;
     }
     try
     {
         using (Folder folder = Folder.Bind(base.UserContext.MailboxSession, this.telephoneFolderId, new PropertyDefinition[]
         {
             FolderSchema.DisplayName
         }))
         {
             this.TelephoneFolderName = folder.DisplayName;
         }
     }
     catch (ObjectNotFoundException)
     {
         ExTraceGlobals.CoreCallTracer.TraceDebug <StoreObjectId>(0L, "The folder doesn't exist. Folder Id: {0}", this.telephoneFolderId);
         this.telephoneFolderId = base.UserContext.InboxFolderId;
         using (Folder folder2 = Folder.Bind(base.UserContext.MailboxSession, this.telephoneFolderId, new PropertyDefinition[]
         {
             FolderSchema.DisplayName
         }))
         {
             this.TelephoneFolderName = folder2.DisplayName;
         }
     }
     using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
     {
         ipaastore.GetUserPermissions(out this.enabledForPersonalAutoAttendant, out this.enabledForOutdialing);
         if (this.enabledForPersonalAutoAttendant)
         {
             this.personalAutoAttendantToolbar = new PersonalAutoAttendantListToolbar();
         }
     }
 }
Ejemplo n.º 10
0
        public void Save()
        {
            string text = (string)base.GetParameter("Name");

            if (!string.IsNullOrEmpty(text))
            {
                text = text.Trim();
            }
            if (string.IsNullOrEmpty(text))
            {
                base.RenderPartialFailure(-1816947001);
                return;
            }
            if (text.Length > 256)
            {
                text = text.Substring(0, 256);
            }
            string text2 = (string)base.GetParameter("Id");

            using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
            {
                IList <PersonalAutoAttendant> list = null;
                ipaastore.TryGetAutoAttendants(PAAValidationMode.None, out list);
                if (list.Count >= 9 && string.IsNullOrEmpty(text2))
                {
                    base.RenderPartialFailure(1125061902);
                }
                else
                {
                    PersonalAutoAttendant personalAutoAttendant = PersonalAutoAttendant.CreateNew();
                    personalAutoAttendant.Name = text;
                    string[] array = (string[])base.GetParameter("Ext");
                    if (array != null)
                    {
                        foreach (string item in array)
                        {
                            personalAutoAttendant.ExtensionList.Add(item);
                        }
                    }
                    if (base.IsParameterSet("SchS"))
                    {
                        int freeBusy = (int)base.GetParameter("SchS");
                        personalAutoAttendant.FreeBusy = (FreeBusyStatusEnum)freeBusy;
                    }
                    this.AddDuration(personalAutoAttendant);
                    this.AddCallerId(personalAutoAttendant);
                    if (base.GetParameter("OOF") != null)
                    {
                        personalAutoAttendant.OutOfOffice = OutOfOfficeStatusEnum.Oof;
                    }
                    this.AddFindMe(personalAutoAttendant);
                    this.AddTransferTo(personalAutoAttendant);
                    if (base.GetParameter("RecVM") == null)
                    {
                        personalAutoAttendant.KeyMappingList.Remove(10);
                    }
                    personalAutoAttendant.EnableBargeIn = (bool)base.GetParameter("Intrpt");
                    personalAutoAttendant.Enabled       = true;
                    if (string.IsNullOrEmpty(text2))
                    {
                        list.Add(personalAutoAttendant);
                    }
                    else
                    {
                        Guid identity = new Guid(Convert.FromBase64String(text2));
                        personalAutoAttendant.Identity = identity;
                        PersonalAutoAttendant autoAttendant = ipaastore.GetAutoAttendant(identity, PAAValidationMode.None);
                        int index = list.Count;
                        if (autoAttendant != null)
                        {
                            index = list.IndexOf(autoAttendant);
                            list.RemoveAt(index);
                        }
                        list.Insert(index, personalAutoAttendant);
                    }
                    if (base.IsParameterSet("SvO"))
                    {
                        this.Writer.Write("<div id=paaId>");
                        Utilities.HtmlEncode(Convert.ToBase64String(personalAutoAttendant.Identity.ToByteArray()), this.Writer);
                        this.Writer.Write("</div>");
                    }
                    ipaastore.Save(list);
                }
            }
        }
Ejemplo n.º 11
0
        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);
            }
        }