protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ADRecipient adrecipient = (ADRecipient)base.PrepareDataObject();

            if (this.secondaryDialPlan != null)
            {
                IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateUmProxyAddressLookup(this.secondaryDialPlan);
                ADRecipient        adrecipient2       = iadrecipientLookup.LookupByExtensionAndEquivalentDialPlan(this.SecondaryAddress, this.secondaryDialPlan);
                if (adrecipient2 != null && adrecipient2.PrimarySmtpAddress != adrecipient.PrimarySmtpAddress)
                {
                    base.WriteError(new TaskArgumentException(DirectoryStrings.ExtensionNotUnique(this.SecondaryAddress, this.secondaryDialPlan.Name)), ExchangeErrorCategory.Client, adrecipient.Identity);
                }
                try
                {
                    adrecipient.AddEUMProxyAddress(this.SecondaryAddress, this.secondaryDialPlan);
                }
                catch (InvalidOperationException ex)
                {
                    base.WriteError(new TaskException(Strings.ErrorStampSecondaryAddress(ex.Message), ex), ExchangeErrorCategory.Client, adrecipient);
                }
            }
            if (this.RemovePicture.IsPresent)
            {
                adrecipient.ThumbnailPhoto = null;
            }
            if (this.RemoveSpokenName.IsPresent)
            {
                adrecipient.UMSpokenName = null;
            }
            TaskLogger.LogExit();
            return(adrecipient);
        }
        // Token: 0x06001CB8 RID: 7352 RVA: 0x00073014 File Offset: 0x00071214
        private List <Persona> GetGALPersonas(string result, List <string> galLinksToRemove)
        {
            Dictionary <string, PeopleSpeechPersonObject> dictionary = FindPeopleSpeechRecognitionResultHandler.RetrieveGALContactsFromXML(result);

            FindPeopleSpeechRecognitionResultHandler.MakeGalContactsUnique(dictionary, galLinksToRemove);
            List <Persona>     list = new List <Persona>(dictionary.Count);
            IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromADRecipient(this.userRecipient, true);
            List <string>      list2 = new List <string>(dictionary.Count);
            Dictionary <string, PeopleSpeechPersonObject> dictionary2 = new Dictionary <string, PeopleSpeechPersonObject>(dictionary.Count);

            foreach (KeyValuePair <string, PeopleSpeechPersonObject> keyValuePair in dictionary)
            {
                list2.Add(keyValuePair.Value.Identifier);
                dictionary2.Add(keyValuePair.Value.Identifier, keyValuePair.Value);
            }
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <int>((long)this.GetHashCode(), "Looking up ADRecipient by smtpAddresses count:{0}", list2.Count);
            ADRecipient[] array = iadrecipientLookup.LookupBySmtpAddresses(list2);
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <int>((long)this.GetHashCode(), "Finished looking up ADRecipient by smtpAddresses count:{0}", list2.Count);
            foreach (ADRecipient adrecipient in array)
            {
                Persona personaFromUser = FindPeopleSpeechRecognitionResultHandler.GetPersonaFromUser(adrecipient);
                personaFromUser.SpeechConfidence = dictionary2[adrecipient.PrimarySmtpAddress.ToString()].Confidence;
                list.Add(personaFromUser);
            }
            return(list);
        }
        // Token: 0x06001CAA RID: 7338 RVA: 0x000729F0 File Offset: 0x00070BF0
        public FindPeopleSpeechRecognitionResultHandler(RequestParameters parameters, UserContext userContext, HttpContext httpContext)
        {
            IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromTenantGuid(parameters.TenantGuid);

            this.userRecipient = iadrecipientLookup.LookupByObjectId(new ADObjectId(parameters.UserObjectGuid));
            this.userContext   = userContext;
            this.httpContext   = httpContext;
        }
Example #4
0
        // Token: 0x06001113 RID: 4371 RVA: 0x000635C4 File Offset: 0x000617C4
        protected override Dictionary <Guid, OrganizationId> GetTenantsNeedingGrammars(List <ADUser> systemMailboxes)
        {
            UMTracer.DebugTrace("DatacenterUMGrammarTenantCache.GetTenantsNeedingGrammars", new object[0]);
            Dictionary <Guid, OrganizationId> dictionary = new Dictionary <Guid, OrganizationId>();

            foreach (ADUser aduser in systemMailboxes)
            {
                if (aduser.OrganizationId != null && aduser.OrganizationId.ConfigurationUnit != null && aduser.OrganizationId.OrganizationalUnit != null)
                {
                    if (SharedConfiguration.IsSharedConfiguration(aduser.OrganizationId))
                    {
                        UMTracer.DebugTrace("Skipping Mbox='{0}', Organization='{1}' because it is a shared configuration", new object[]
                        {
                            aduser.ExchangeGuid,
                            aduser.OrganizationId
                        });
                    }
                    else
                    {
                        IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromOrganizationId(aduser.OrganizationId, null);
                        if (iadrecipientLookup.TenantSizeExceedsThreshold(GrammarRecipientHelper.GetUserFilter(), 10))
                        {
                            if (!dictionary.ContainsKey(aduser.ExchangeGuid))
                            {
                                UMTracer.DebugTrace("Adding Mbox='{0}', Organization='{1}'", new object[]
                                {
                                    aduser.ExchangeGuid,
                                    aduser.OrganizationId
                                });
                                dictionary.Add(aduser.ExchangeGuid, aduser.OrganizationId);
                            }
                            else
                            {
                                UMTracer.DebugTrace("Skipping Mbox='{0}', Organization='{1}' because Mbox is already included. ", new object[]
                                {
                                    aduser.ExchangeGuid,
                                    aduser.OrganizationId
                                });
                            }
                        }
                        else
                        {
                            UMTracer.DebugTrace("Skipping Mbox='{0}', Organization='{1}' because it does not exceed size threshold", new object[]
                            {
                                aduser.ExchangeGuid,
                                aduser.OrganizationId
                            });
                        }
                    }
                }
            }
            return(dictionary);
        }
Example #5
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);
        }
 // Token: 0x060010DC RID: 4316 RVA: 0x0006299C File Offset: 0x00060B9C
 public void CheckScaleRequirements()
 {
     this.Logger.TraceDebug(this, "Entering CheckScaleRequirements", new object[0]);
     if (VariantConfiguration.InvariantNoFlightingSnapshot.MailboxAssistants.OrgMailboxCheckScaleRequirements.Enabled)
     {
         try
         {
             IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromOrganizationId(this.OrgId, null, null, false);
             ADUser             aduser             = iadrecipientLookup.LookupByExchangeGuid(this.RunData.MailboxGuid) as ADUser;
             if (aduser != null && aduser.PersistedCapabilities.Contains((Capability)this.CapabilityRequiringScaling))
             {
                 if (OrgMailboxScaleOutHelper.IsFactoryDefaultMailbox(aduser.Name))
                 {
                     this.Logger.TraceDebug(this, "CheckOrgMailboxScaleRequirements - Checking tenant size, mailbox='{0}'", new object[]
                     {
                         aduser.Name
                     });
                     int mailboxCount  = 0;
                     int contactCount  = 0;
                     int mailUserCount = 0;
                     this.GetTenantRecipientCount(out mailboxCount, out contactCount, out mailUserCount);
                     int organizationMailboxCount = this.GetOrganizationMailboxCount();
                     this.Logger.TraceDebug(this, "CheckOrgMailboxScaleRequirements - Scale out threshold='{0}'", new object[]
                     {
                         OrgMailboxScaleOutHelper.scaleOutThreshold
                     });
                     bool shouldCapabilityExist = this.ShouldStampScaleOutCapability(mailboxCount, contactCount, mailUserCount, organizationMailboxCount, OrgMailboxScaleOutHelper.scaleOutThreshold);
                     this.UpdateOrganizationScaleOutCapability(aduser, shouldCapabilityExist);
                 }
                 this.UpdateOrganizationMailboxCapabilities(aduser);
             }
         }
         catch (LocalizedException obj)
         {
             UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_SetScaleOutCapabilityFailed, null, new object[]
             {
                 this.RunData.TenantId,
                 this.RunData.MailboxGuid,
                 this.RunData.RunId,
                 CommonUtil.ToEventLogString(obj)
             });
         }
     }
     this.Logger.TraceDebug(this, "Exiting CheckScaleRequirements", new object[0]);
 }
        // Token: 0x06000B05 RID: 2821 RVA: 0x000478FC File Offset: 0x00045AFC
        protected override void HandleEventInternal(MapiEvent mapiEvent, MailboxSession mailboxSession, StoreObject item, List <KeyValuePair <string, object> > customDataToLog)
        {
            if (mailboxSession == null)
            {
                throw new ArgumentNullException("mailboxSession");
            }
            if (item == null)
            {
                UMPartnerMessageAssistant.Tracer.TraceWarning <MapiEvent, StoreObject>((long)this.GetHashCode(), "UMPMA.HandleEvent: Ignoring evt={0}, item={1}", mapiEvent, item);
                return;
            }
            IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromOrganizationId(mailboxSession.MailboxOwner.MailboxInfo.OrganizationId, null);
            ADUser             aduser             = iadrecipientLookup.LookupByExchangeGuid(mailboxSession.MailboxGuid) as ADUser;

            if (aduser == null)
            {
                UMPartnerMessageAssistant.Tracer.TraceWarning <Guid>((long)this.GetHashCode(), "UMPMA.HandleEvent: Could not find ADUser for mailbox {0} {1}", mailboxSession.MailboxGuid);
                throw new SkipException(new UserNotUmEnabledException(mailboxSession.MailboxGuid.ToString()));
            }
            if (!aduser.UMEnabled || aduser.UMMailboxPolicy == null || aduser.UMRecipientDialPlanId == null)
            {
                UMPartnerMessageAssistant.Tracer.TraceWarning(0L, "UMPMA.HandleEvent({0} - {1}) - Invalid user: UMEnabled({2}) UMMbxPol({3}) DialPlan({4})", new object[]
                {
                    mailboxSession.MailboxGuid,
                    aduser.DistinguishedName,
                    aduser.UMEnabled,
                    aduser.UMMailboxPolicy,
                    aduser.UMRecipientDialPlanId
                });
                throw new SkipException(new UserNotUmEnabledException(aduser.DistinguishedName));
            }
            try
            {
                this.ProcessEvent(aduser, mailboxSession, item);
            }
            catch (Exception arg)
            {
                UMPartnerMessageAssistant.Tracer.TraceWarning <Guid, string, Exception>(0L, "UMPMA.HandleEvent({0} - {1}) - Exception:{2}", mailboxSession.MailboxGuid, aduser.DistinguishedName, arg);
                throw;
            }
        }
Example #8
0
        // Token: 0x06001009 RID: 4105 RVA: 0x0005DB38 File Offset: 0x0005BD38
        private void DownloadRecipients(string runFolderPath)
        {
            base.Logger.TraceDebug(this, "Entering ADCrawler.DownloadRecipients", new object[0]);
            string entriesFilePath = this.GetEntriesFilePath(runFolderPath);

            base.Logger.TraceDebug(this, "ADCrawler.DownloadRecipients - entriesFilePath='{0}'", new object[]
            {
                entriesFilePath
            });
            using (XmlWriter entryWriter = XmlWriter.Create(entriesFilePath, this.CreateXmlWriterSettings()))
            {
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_CopyADToFileStarted, null, new object[]
                {
                    this.ADEntriesFileName,
                    base.TenantId,
                    base.RunId
                });
                int numRecipients = 0;
                entryWriter.WriteStartDocument();
                entryWriter.WriteStartElement("ADEntries");
                IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromOrganizationId(base.OrgId, null);
                iadrecipientLookup.ProcessRecipients(this.RecipientFilter, GrammarRecipientHelper.LookupProperties, delegate(ADRawEntry entry)
                {
                    numRecipients++;
                    this.WriteADEntry(entryWriter, entry);
                    this.RunData.ThrowIfShuttingDown();
                }, 5);
                entryWriter.WriteEndElement();
                entryWriter.WriteEndDocument();
                this.UpdateRecipientCount(numRecipients);
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_CopyADToFileCompleted, null, new object[]
                {
                    this.ADEntriesFileName,
                    base.TenantId,
                    base.RunId
                });
            }
        }