protected override void InternalProcessRecord()
 {
     base.InternalProcessRecord();
     if (this.CustomVoicemailGreeting || this.CustomAwayGreeting)
     {
         using (UMSubscriber umsubscriber = UMRecipient.Factory.FromADRecipient <UMSubscriber>(this.DataObject))
         {
             if (umsubscriber != null)
             {
                 try
                 {
                     if (this.CustomVoicemailGreeting)
                     {
                         umsubscriber.RemoveCustomGreeting(MailboxGreetingEnum.Voicemail);
                     }
                     if (this.CustomAwayGreeting)
                     {
                         umsubscriber.RemoveCustomGreeting(MailboxGreetingEnum.Away);
                     }
                     goto IL_85;
                 }
                 catch (UserConfigurationException exception)
                 {
                     base.WriteError(exception, (ErrorCategory)1001, null);
                     goto IL_85;
                 }
             }
             base.WriteError(new UserNotUmEnabledException(this.Identity.ToString()), (ErrorCategory)1000, null);
             IL_85 :;
         }
     }
 }
Exemplo n.º 2
0
        protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject)
        {
            PINInfo pininfo = null;
            ADUser  aduser  = dataObject as ADUser;

            this.userObject = aduser;
            if (UMSubscriber.IsValidSubscriber(aduser))
            {
                this.matchFound = true;
                try
                {
                    using (IUMUserMailboxStorage umuserMailboxAccessor = InterServerMailboxAccessor.GetUMUserMailboxAccessor(aduser, false))
                    {
                        pininfo = umuserMailboxAccessor.GetUMPin();
                    }
                    goto IL_84;
                }
                catch (LocalizedException ex)
                {
                    throw new InvalidOperationForGetUMMailboxPinException(Strings.GetPINInfoError(aduser.PrimarySmtpAddress.ToString(), ex.LocalizedString), ex);
                }
                goto IL_64;
IL_84:
                return(new UMMailboxPin(aduser, pininfo.PinExpired, pininfo.LockedOut, pininfo.FirstTimeUser, base.NeedSuppressingPiiData));
            }
IL_64:
            throw new InvalidOperationForGetUMMailboxPinException(Strings.InvalidUMUserName(aduser.PrimarySmtpAddress.ToString()));
        }
Exemplo n.º 3
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     base.InternalProcessRecord();
     using (UMSubscriber umsubscriber = UMRecipient.Factory.FromADRecipient <UMSubscriber>(this.DataObject))
     {
         if (umsubscriber != null)
         {
             try
             {
                 UMMailboxConfiguration presentationObject = this.GetPresentationObject(umsubscriber);
                 base.WriteObject(presentationObject);
                 goto IL_57;
             }
             catch (UserConfigurationException exception)
             {
                 base.WriteError(exception, (ErrorCategory)1001, null);
                 goto IL_57;
             }
         }
         base.WriteError(new UserNotUmEnabledException(this.Identity.ToString()), (ErrorCategory)1000, null);
         IL_57 :;
     }
     TaskLogger.LogExit();
 }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.InternalProcessRecord();
            using (UMSubscriber umsubscriber = UMRecipient.Factory.FromADRecipient <UMSubscriber>(this.DataObject))
            {
                if (umsubscriber != null)
                {
                    UMMailboxPromptRpcRequest request = null;
                    string empty = string.Empty;
                    string parameterSetName;
                    if ((parameterSetName = base.ParameterSetName) != null)
                    {
                        if (parameterSetName == "DefaultVoicemailGreeting")
                        {
                            request = UMMailboxPromptRpcRequest.CreateVoicemailPromptRequest(this.DataObject, this.TestPhoneticDisplayName);
                            goto IL_CD;
                        }
                        if (parameterSetName == "DefaultAwayGreeting")
                        {
                            request = UMMailboxPromptRpcRequest.CreateAwayPromptRequest(this.DataObject, this.TestPhoneticDisplayName);
                            goto IL_CD;
                        }
                        if (parameterSetName == "CustomVoicemailGreeting")
                        {
                            request = UMMailboxPromptRpcRequest.CreateCustomVoicemailPromptRequest(this.DataObject);
                            goto IL_CD;
                        }
                        if (parameterSetName == "CustomAwayGreeting")
                        {
                            request = UMMailboxPromptRpcRequest.CreateCustomAwayPromptRequest(this.DataObject);
                            goto IL_CD;
                        }
                    }
                    ExAssert.RetailAssert(false, "Invalid parameter set {0}", new object[]
                    {
                        base.ParameterSetName
                    });
                    try
                    {
IL_CD:
                        base.WriteObject(new UMPrompt(this.DataObject.Identity)
                        {
                            AudioData = this.GetUMPromptPreview(request, ((ADObjectId)umsubscriber.DialPlan.Identity).ObjectGuid),
                            Name      = base.ParameterSetName
                        });
                        goto IL_13D;
                    }
                    catch (LocalizedException exception)
                    {
                        base.WriteError(exception, ErrorCategory.NotSpecified, null);
                        goto IL_13D;
                    }
                }
                base.WriteError(new UserNotUmEnabledException(this.Identity.ToString()), (ErrorCategory)1000, null);
                IL_13D :;
            }
            TaskLogger.LogExit();
        }
Exemplo n.º 5
0
 private bool UserUMEnabled(ADUser user)
 {
     UmConnectivityCredentialsHelper.DebugTrace("UmConnectivityCredentialsHelper::UserUMEnabled()", new object[0]);
     if (user != null)
     {
         using (UMSubscriber umsubscriber = UMRecipient.Factory.FromADRecipient <UMSubscriber>(user))
         {
             if (umsubscriber != null)
             {
                 this.userDP = umsubscriber.DialPlan;
                 return(true);
             }
         }
         return(false);
     }
     return(false);
 }
Exemplo n.º 6
0
        protected override void DoValidate()
        {
            LocalizedException ex = null;

            if (!UMSubscriber.IsValidSubscriber(this.DataObject))
            {
                ex = new UserAlreadyUmDisabledException(this.DataObject.PrimarySmtpAddress.ToString());
            }
            else
            {
                Utility.ResetUMADProperties(this.DataObject, this.KeepProperties);
            }
            if (ex != null)
            {
                base.WriteError(ex, ErrorCategory.InvalidArgument, null);
            }
        }
Exemplo n.º 7
0
        protected override void DoValidate()
        {
            LocalizedException ex         = null;
            ADUser             dataObject = this.DataObject;

            if (!UMSubscriber.IsValidSubscriber(dataObject))
            {
                ex = new UserNotUmEnabledException(this.DataObject.PrimarySmtpAddress.ToString());
            }
            else
            {
                base.PinInfo            = base.ValidateOrGeneratePIN(this.Pin);
                base.PinInfo.PinExpired = this.PinExpired;
                base.PinInfo.LockedOut  = this.LockedOut;
            }
            if (ex != null)
            {
                base.WriteError(ex, ErrorCategory.InvalidArgument, null);
            }
        }
Exemplo n.º 8
0
        private UMMailboxConfiguration GetPresentationObject(UMSubscriber subscriber)
        {
            UMMailboxConfiguration ummailboxConfiguration = new UMMailboxConfiguration(this.DataObject.Identity);

            ummailboxConfiguration.Greeting = subscriber.ConfigFolder.CurrentMailboxGreetingType;
            ummailboxConfiguration.DefaultPlayOnPhoneNumber           = subscriber.ConfigFolder.PlayOnPhoneDialString;
            ummailboxConfiguration.ReadOldestUnreadVoiceMessagesFirst = subscriber.ConfigFolder.ReadUnreadVoicemailInFIFOOrder;
            ummailboxConfiguration.ReceivedVoiceMailPreviewEnabled    = subscriber.ConfigFolder.ReceivedVoiceMailPreviewEnabled;
            ummailboxConfiguration.SentVoiceMailPreviewEnabled        = subscriber.ConfigFolder.SentVoiceMailPreviewEnabled;
            byte[]          entryId       = Convert.FromBase64String(subscriber.ConfigFolder.TelephoneAccessFolderEmail);
            StoreObjectId   storeObjectId = StoreObjectId.FromProviderSpecificId(entryId);
            ADUser          dataObject    = this.DataObject;
            MailboxFolderId identity      = new MailboxFolderId(dataObject.Id, storeObjectId, null);

            using (MailboxFolderDataProvider mailboxFolderDataProvider = new MailboxFolderDataProvider(base.SessionSettings, this.DataObject, "get-ummailboxconfiguration"))
            {
                ummailboxConfiguration.FolderToReadEmailsFrom = (MailboxFolder)mailboxFolderDataProvider.Read <MailboxFolder>(identity);
            }
            return(ummailboxConfiguration);
        }
        private void SetPropertiesOnUMSubscriber(UMSubscriber subscriber)
        {
            bool flag = false;

            if (base.Fields.IsModified("Greeting"))
            {
                subscriber.ConfigFolder.CurrentMailboxGreetingType = this.Greeting;
                flag = true;
            }
            if (base.Fields.IsModified("ReadOldestUnreadVoiceMessageFirst"))
            {
                subscriber.ConfigFolder.ReadUnreadVoicemailInFIFOOrder = this.ReadOldestUnreadVoiceMessagesFirst;
                flag = true;
            }
            if (base.Fields.IsModified("DefaultPlayOnPhoneNumber"))
            {
                subscriber.ConfigFolder.PlayOnPhoneDialString = this.DefaultPlayOnPhoneNumber;
                flag = true;
            }
            if (base.Fields.IsModified("ReceivedVoiceMailPreviewEnabled"))
            {
                subscriber.ConfigFolder.ReceivedVoiceMailPreviewEnabled = this.ReceivedVoiceMailPreviewEnabled;
                flag = true;
            }
            if (base.Fields.IsModified("SentVoiceMailPreviewEnabled"))
            {
                subscriber.ConfigFolder.SentVoiceMailPreviewEnabled = this.SentVoiceMailPreviewEnabled;
                flag = true;
            }
            if (this.mailboxFolder != null)
            {
                StoreObjectId objectId = this.mailboxFolder.InternalFolderIdentity.ObjectId;
                subscriber.ConfigFolder.TelephoneAccessFolderEmail = Convert.ToBase64String(objectId.ProviderLevelItemId);
                flag = true;
            }
            if (flag)
            {
                subscriber.ConfigFolder.Save();
            }
        }
Exemplo n.º 10
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:;
         }
     }
 }
            // Token: 0x06000A82 RID: 2690 RVA: 0x00044F28 File Offset: 0x00043128
            public void Emit(MailboxSession session, CalendarNotificationType type, IList <CalendarInfo> calendarInfos)
            {
                ADRecipient adrecipient = Utils.GetADRecipient(this.tenantGuid, this.ownerLegacyDN);

                if (!UMSubscriber.IsValidSubscriber(adrecipient))
                {
                    ExTraceGlobals.AssistantTracer.TraceDebug <string>((long)this.GetHashCode(), "UM is not enabled for user {0}", this.ownerLegacyDN);
                    return;
                }
                using (UMSubscriber umsubscriber = new UMSubscriber(adrecipient))
                {
                    if (!umsubscriber.UMMailboxPolicy.AllowVoiceNotification || this.IsThisActionAllowed())
                    {
                        ExTraceGlobals.AssistantTracer.TraceDebug <string, string, bool>((long)this.GetHashCode(), "Abort Voice Emitter, subject: {0}, user: {1}, UM Mailboxpolicy AllowVoiceNotification = {2}", calendarInfos[0].NormalizedSubject, this.ownerLegacyDN, umsubscriber.UMMailboxPolicy.AllowVoiceNotification);
                        return;
                    }
                    ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Voice Emitter is emitting, subject: {0}, user: {1} ", calendarInfos[0].NormalizedSubject, this.ownerLegacyDN);
                    UMServerManager.GetServerByDialplan((ADObjectId)umsubscriber.DialPlan.Identity);
                }
                string voiceReminderPhoneNumber = calendarInfos[0].VoiceReminderPhoneNumber;

                CalNotifsCounters.NumberOfVoiceRemindersSent.Increment();
                ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Voice Emitter is emitted, subject: {0}, user: {1}", calendarInfos[0].NormalizedSubject, this.ownerLegacyDN);
            }
Exemplo n.º 12
0
        protected override void DoValidate()
        {
            LocalizedException ex = null;

            if (this.ShouldInitUMMailbox && UMSubscriber.IsValidSubscriber(this.DataObject))
            {
                ex = new UserAlreadyUmEnabledException(this.DataObject.Id.Name);
            }
            else if (!this.IsUserAllowedForUnifiedMessaging(this.DataObject))
            {
                ex = new UserNotAllowedForUMEnabledException();
            }
            else
            {
                MailboxPolicyIdParameter ummailboxPolicy = this.UMMailboxPolicy;
                this.mailboxPolicy = (UMMailboxPolicy)base.GetDataObject <UMMailboxPolicy>(ummailboxPolicy, this.ConfigurationSession, null, new LocalizedString?(Strings.UMMailboxPolicyIdNotFound(ummailboxPolicy.ToString())), new LocalizedString?(Strings.MultipleUMMailboxPolicyWithSameId(ummailboxPolicy.ToString())));
                this.dialPlan      = this.mailboxPolicy.GetDialPlan();
                if (this.DialPlan.SubscriberType != UMSubscriberType.Consumer || this.DialPlan.URIType != UMUriType.E164 || !string.IsNullOrEmpty(this.SIPResourceIdentifier) || (this.Extensions != null && this.Extensions.Count != 0))
                {
                    if (this.Extensions == null || this.Extensions.Count == 0)
                    {
                        string      text = null;
                        PhoneNumber phoneNumber;
                        if (PhoneNumber.TryParse(this.DataObject.Phone, out phoneNumber))
                        {
                            text = this.DialPlan.GetDefaultExtension(phoneNumber.Number);
                        }
                        if (!string.IsNullOrEmpty(Utils.TrimSpaces(text)))
                        {
                            this.Extensions = new MultiValuedProperty <string>(text);
                        }
                    }
                    if (this.DialPlan.URIType == UMUriType.SipName)
                    {
                        ProxyAddress proxyAddress = this.DataObject.EmailAddresses.Find((ProxyAddress p) => string.Equals(p.PrefixString, "sip", StringComparison.OrdinalIgnoreCase));
                        string       text2        = (proxyAddress != null) ? proxyAddress.AddressString : null;
                        if (string.IsNullOrEmpty(this.SIPResourceIdentifier))
                        {
                            this.SIPResourceIdentifier = ((text2 != null) ? text2 : null);
                        }
                        else if (text2 != null && !string.Equals(this.SIPResourceIdentifier, text2, StringComparison.OrdinalIgnoreCase))
                        {
                            ex = new SIPResouceIdConflictWithExistingValue(this.SIPResourceIdentifier, text2);
                            base.WriteError(ex, ErrorCategory.InvalidArgument, null);
                        }
                    }
                    IRecipientSession            tenantLocalRecipientSession = RecipientTaskHelper.GetTenantLocalRecipientSession(this.DataObject.OrganizationId, base.ExecutingUserOrganizationId, base.RootOrgContainerId);
                    LocalizedException           ex2 = null;
                    TelephoneNumberProcessStatus telephoneNumberProcessStatus;
                    Utils.ValidateExtensionsAndSipResourceIdentifier(tenantLocalRecipientSession, this.ConfigurationSession, CommonConstants.DataCenterADPresent, this.DataObject, this.DialPlan, (this.Extensions != null) ? this.Extensions.ToArray() : null, null, this.SIPResourceIdentifier, out ex2, out telephoneNumberProcessStatus);
                    if (ex2 != null)
                    {
                        this.DataObject.EmailAddresses.Clear();
                        ex = ex2;
                    }
                }
            }
            if (ex == null || this.ValidateOnly)
            {
                this.DataObject.UMEnabledFlags |= UMEnabledFlags.UMEnabled;
                if (base.Fields.IsModified("ASREnabled"))
                {
                    bool flag = (bool)base.Fields["ASREnabled"];
                    if (flag)
                    {
                        this.DataObject.UMEnabledFlags |= UMEnabledFlags.ASREnabled;
                    }
                    else
                    {
                        this.DataObject.UMEnabledFlags = (this.DataObject.UMEnabledFlags & ~UMEnabledFlags.ASREnabled);
                    }
                }
                this.DataObject.PopulateDtmfMap(true);
                if (!this.ValidateOnly)
                {
                    Utils.UMPopulate(this.DataObject, this.SIPResourceIdentifier, this.Extensions, this.mailboxPolicy, this.DialPlan);
                    if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled)
                    {
                        RecipientTaskHelper.ValidateSmtpAddress(this.ConfigurationSession, this.DataObject.EmailAddresses, this.DataObject, new Task.ErrorLoggerDelegate(base.WriteError), base.ProvisioningCache);
                    }
                    if (this.ShouldSavePin)
                    {
                        base.PinInfo            = base.ValidateOrGeneratePIN(this.Pin, this.mailboxPolicy.Guid);
                        base.PinInfo.PinExpired = this.PinExpired;
                        base.PinInfo.LockedOut  = false;
                    }
                }
                else if (this.Extensions != null)
                {
                    this.DataObject.AddEUMProxyAddress(this.Extensions, this.DialPlan);
                }
            }
            if (ex == null)
            {
                if (this.ValidateOnly)
                {
                    this.WriteResult();
                }
                return;
            }
            if (this.ValidateOnly)
            {
                this.WriteResult();
                base.WriteError(ex, ErrorCategory.InvalidArgument, null, false, null);
                return;
            }
            base.WriteError(ex, ErrorCategory.InvalidArgument, null);
        }