コード例 #1
0
        // Token: 0x06000ABB RID: 2747 RVA: 0x00046114 File Offset: 0x00044314
        private void ProcessMailboxForSMS(MailboxInfo mailbox, MailboxSession session, StoreObject item, ADUser user, UMDialPlan dialPlan)
        {
            if (mailbox.MapiEvent == null || session == null || item == null)
            {
                ExTraceGlobals.MWITracer.TraceDebug((long)this.GetHashCode(), "MwiAssistant.ProcessMailboxForSMS: Skipping for {0} (event={1}, session={2}, item={3})", new object[]
                {
                    mailbox,
                    mailbox.MapiEvent,
                    session,
                    item
                });
                return;
            }
            UMMailbox ummailbox = new UMMailbox(user);

            if (ummailbox.UMSMSNotificationOption == UMSMSNotificationOptions.None)
            {
                ExTraceGlobals.MWITracer.TraceDebug <MailboxInfo>((long)this.GetHashCode(), "MwiAssistant.ProcessMailboxForSMS: Skipping {0}. UMSMSNotificationOptions=None", mailbox);
                return;
            }
            if (MwiAssistant.IsMissedCallMessageEvent(mailbox.MapiEvent) && ummailbox.UMSMSNotificationOption != UMSMSNotificationOptions.VoiceMailAndMissedCalls)
            {
                ExTraceGlobals.MWITracer.TraceDebug <MailboxInfo, string>((long)this.GetHashCode(), "MwiAssistant.ProcessMailboxForSMS: Skipping {0}. UMSMSNotificationOptions={1}", mailbox, ummailbox.UMSMSNotificationOption.ToString());
                return;
            }
            this.SendSMSMessage(mailbox, session, item, user, dialPlan);
        }
コード例 #2
0
        // Token: 0x06000AB1 RID: 2737 RVA: 0x00045CD8 File Offset: 0x00043ED8
        private static bool TryGetNotificationPhoneNumber(MailboxInfo mailbox, MailboxSession session, ADUser user, out string phoneNumber, out CultureInfo notificationPreferredCulture)
        {
            phoneNumber = null;
            notificationPreferredCulture = null;
            TextMessagingAccount textMessagingAccount = null;

            if (MwiAssistant.TryReadTextMessagingAccount(session, out textMessagingAccount))
            {
                bool flag = TextMessagingHelper.IsMachineToPersonTextingOnlyAccount(textMessagingAccount);
                ExTraceGlobals.MWITracer.TraceDebug(0L, "MwiAssistant: TryGetNotificationPhoneNumber User = {0}, EASEnabled = {1}, Phone Number Verified = {2}, Phone Number = {3}, Can send sms = {4}", new object[]
                {
                    user.DistinguishedName,
                    textMessagingAccount.EasEnabled,
                    textMessagingAccount.NotificationPhoneNumberVerified,
                    (textMessagingAccount.NotificationPhoneNumber != null && textMessagingAccount.NotificationPhoneNumber.Number != null) ? textMessagingAccount.NotificationPhoneNumber.Number : "<null>",
                    flag
                });
                if (flag)
                {
                    phoneNumber = textMessagingAccount.NotificationPhoneNumber.Number;
                    notificationPreferredCulture = textMessagingAccount.NotificationPreferredCulture;
                }
            }
            else
            {
                ExTraceGlobals.MWITracer.TraceWarning <string>(0L, "MwiAssistant: TryGetNotificationPhoneNumber Cannot send SMS because TextMessagingAccount does not exist for User {0}", user.DistinguishedName);
            }
            return(phoneNumber != null);
        }
コード例 #3
0
        // Token: 0x06000ABA RID: 2746 RVA: 0x00046080 File Offset: 0x00044280
        private void ProcessMailboxForMWI(MailboxInfo mailbox, MailboxSession session, StoreObject item, UMDialPlan dialPlan)
        {
            bool flag = mailbox.MapiEvent == null;

            if (dialPlan.SubscriberType == UMSubscriberType.Consumer)
            {
                ExTraceGlobals.MWITracer.TraceDebug <MailboxInfo>((long)this.GetHashCode(), "MwiAssistant.ProcessMailboxForMWI: Skipping for {0} (MWI N/A for consumer dialplan)", mailbox);
                return;
            }
            if (!flag && !MwiAssistant.IsVoicemailSearchFolderEvent(mailbox.MapiEvent))
            {
                ExTraceGlobals.MWITracer.TraceDebug <MailboxInfo>((long)this.GetHashCode(), "MwiAssistant.ProcessMailboxForMWI: Skipping for {0} (MWI only av. for healing/search folder events)", mailbox);
                return;
            }
            mailbox.EventTimeUtc = (flag ? ExDateTime.UtcNow : new ExDateTime(ExTimeZone.UtcTimeZone, mailbox.MapiEvent.CreateTime));
            this.delayTable.EnqueueMailbox(mailbox, session);
        }
コード例 #4
0
        // Token: 0x06000ABE RID: 2750 RVA: 0x00046574 File Offset: 0x00044774
        private void SendSMSMessage(MailboxInfo mailbox, MailboxSession session, StoreObject item, ADUser user, UMDialPlan dialPlan)
        {
            ExTraceGlobals.MWITracer.TraceDebug <MailboxInfo, MailboxSession, StoreObject>((long)this.GetHashCode(), "MwiAssistant.SendSMSMessage: Mailbox:{0} Session={1} Item={2}", mailbox, session, item);
            string      text;
            CultureInfo preferredCulture;

            if (MwiAssistant.TryGetNotificationPhoneNumber(mailbox, session, user, out text, out preferredCulture))
            {
                StoreObjectId storeObjectId = session.GetDefaultFolderId(DefaultFolderType.Drafts) ?? session.GetDefaultFolderId(DefaultFolderType.Outbox);
                using (Folder.Bind(session, storeObjectId))
                {
                    using (MessageItem messageItem = MessageItem.Create(session, storeObjectId))
                    {
                        messageItem.ClassName = "IPM.Note.Mobile.SMS.Alert.Voicemail";
                        if (MwiAssistant.IsVoiceMessageEvent(mailbox.MapiEvent))
                        {
                            SmsVoicemailNotification smsVoicemailNotification = new SmsVoicemailNotification(session, preferredCulture, item, dialPlan);
                            smsVoicemailNotification.PrepareSmsMessage(messageItem);
                        }
                        else
                        {
                            if (!MwiAssistant.IsMissedCallMessageEvent(mailbox.MapiEvent))
                            {
                                throw new ArgumentException("MapiEvent.ObjectClass");
                            }
                            SmsMissedCallNotification smsMissedCallNotification = new SmsMissedCallNotification(session, preferredCulture, item, dialPlan);
                            smsMissedCallNotification.PrepareSmsMessage(messageItem);
                        }
                        Participant participant = new Participant(null, text, "MOBILE");
                        messageItem.Recipients.Add(participant, RecipientItemType.To);
                        string subject = messageItem.Subject;
                        string text2   = string.Format("{0}:{1}", participant.RoutingType, participant.EmailAddress);
                        ExTraceGlobals.MWITracer.TraceDebug <MailboxInfo, string, string>((long)this.GetHashCode(), "MwiAssistant.SendSMSMessage: Mailbox:{0} Recipient:{1} Subject={2}. Sending...", mailbox, text2, subject);
                        messageItem.Send();
                        UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_MwiTextMessageSent, null, new object[]
                        {
                            subject,
                            mailbox,
                            text,
                            text2
                        });
                    }
                }
            }
        }
コード例 #5
0
 // Token: 0x06000AC4 RID: 2756 RVA: 0x00046BAC File Offset: 0x00044DAC
 private bool TryHandleException(MailboxInfo mailbox, Exception error)
 {
     ExTraceGlobals.MWITracer.TraceError <MailboxInfo, string, Exception>((long)this.GetHashCode(), "MwiAssistant.TryHandleException: Mailbox {0} in database {1}: {2}", mailbox, base.DatabaseInfo.DisplayName, error);
     if (error is StorageTransientException || error is StoragePermanentException || error is LocalServerException || error is DataValidationException || error is DataSourceTransientException || error is DataSourceOperationException)
     {
         if (MwiAssistant.ShouldLogException(error))
         {
             UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_MwiSyncMailboxFailed, null, new object[]
             {
                 mailbox,
                 base.DatabaseInfo.DisplayName,
                 CommonUtil.ToEventLogString(error)
             });
         }
         return(true);
     }
     if (GrayException.IsGrayException(error))
     {
         ExWatson.SendReport(error, ReportOptions.None, null);
         return(true);
     }
     return(false);
 }
コード例 #6
0
 // Token: 0x06000AAD RID: 2733 RVA: 0x00045A7C File Offset: 0x00043C7C
 protected override void OnStartInternal(EventBasedStartInfo startInfo)
 {
     this.assistantUtcStartTime = ExDateTime.UtcNow;
     ExTraceGlobals.MWITracer.TraceDebug <ExDateTime>((long)this.GetHashCode(), "MwiAssistant.OnStartInternal(startTime={0})", this.assistantUtcStartTime);
     using (RegistryKey registryKey = Registry.LocalMachine.CreateSubKey("System\\CurrentControlSet\\Services\\MSExchangeMailboxAssistants\\Parameters"))
     {
         TimeSpan timeSpan;
         if (MwiAssistant.TryReadTimeSpanValue(registryKey, "MwiSyncIntervalInSec", out timeSpan))
         {
             this.syncInterval = timeSpan;
         }
         if (MwiAssistant.TryReadTimeSpanValue(registryKey, "MwiMinUpdateIntervalInSec", out timeSpan))
         {
             this.minUpdateInterval = timeSpan;
         }
     }
     this.delayTable = new MwiDelayTable(this.minUpdateInterval, MwiAssistant.DelayQueueTimerResolution, new ProcessMailboxDelegate(this.DelayTableCallback));
     if (this.syncInterval.TotalSeconds > 0.0)
     {
         this.syncTimer = new Timer(new TimerCallback(this.SyncTimerCallback));
         this.syncTimer.Change(0, -1);
     }
     base.OnStartInternal(startInfo);
 }
コード例 #7
0
        // Token: 0x06000ABD RID: 2749 RVA: 0x00046480 File Offset: 0x00044680
        private void SendMwiMessage(MailboxInfo mailbox, MailboxSession itemStore)
        {
            StoreObjectId umsearchFolderId = MwiAssistant.GetUMSearchFolderId(itemStore);

            if (umsearchFolderId == null)
            {
                ExTraceGlobals.MWITracer.TraceWarning <MailboxInfo>((long)this.GetHashCode(), "MwiAssistant.SendMwiMessage(): Skipping event. Could not get Voice Mail search folder for {0}.", mailbox);
                return;
            }
            using (SearchFolder searchFolder = SearchFolder.Bind(itemStore, umsearchFolderId, new PropertyDefinition[]
            {
                FolderSchema.ItemCount,
                FolderSchema.UnreadCount
            }))
            {
                int itemCount = searchFolder.ItemCount;
                int num       = (int)searchFolder[FolderSchema.UnreadCount];
                ExTraceGlobals.MWITracer.TraceDebug <MailboxInfo, int, int>((long)this.GetHashCode(), "MwiAssistant.SendMwiMessage(): Sending MWI for user {0}, itemCount={1}, unreadCount={2}", mailbox, itemCount, num);
                IADSystemConfigurationLookup iadsystemConfigurationLookup = ADSystemConfigurationLookupFactory.CreateFromOrganizationId(mailbox.OrganizationId);
                Guid       externalDirectoryOrganizationId = iadsystemConfigurationLookup.GetExternalDirectoryOrganizationId();
                MwiMessage message = new MwiMessage(mailbox.Guid, mailbox.DialPlanGuid, mailbox.DisplayName, mailbox.UMExtension, num, itemCount, MwiAssistant.MessageExpirationTime, mailbox.EventTimeUtc, externalDirectoryOrganizationId);
                this.loadBalancer.SendMessage(message);
            }
        }
コード例 #8
0
 // Token: 0x06000AAB RID: 2731 RVA: 0x000459C4 File Offset: 0x00043BC4
 public bool IsEventInteresting(MapiEvent mapiEvent)
 {
     return((MwiAssistant.IsVoicemailSearchFolderEvent(mapiEvent) && mapiEvent.CreateTime >= (DateTime)this.assistantUtcStartTime && (mapiEvent.ItemCount != -1L || mapiEvent.UnreadItemCount != -1L)) || (mapiEvent.ItemType == ObjectType.MAPI_MESSAGE && mapiEvent.EventMask == MapiEventTypeFlags.NewMail && (MwiAssistant.IsMissedCallMessageEvent(mapiEvent) || MwiAssistant.IsVoiceMessageEvent(mapiEvent))));
 }