예제 #1
0
        /// <summary>
        /// Check the DiScribe bot email inbox for Webex invite emails created by scheduling
        /// from Webex.com or from DiScribe web.
        /// </summary>
        /// <param name="appConfig"></param>
        /// <returns></returns>
        private static async Task <object?> CheckForEmails(IConfigurationRoot appConfig)
        {
            MeetingInfo meetingInfo = null;


            try
            {
                var email = await EmailListener.GetEmailAsync();

                meetingInfo = MeetingController.HandleEmail(email.Body.Content.ToString(), email.Subject, "", appConfig);
                await EmailListener.DeleteEmailAsync(email);
            }
            catch (Exception emailEx)
            {
                Console.Error.WriteLine($">\tCould not read bot invite email. Reason: {emailEx.Message}");
                return(null);
            }

            if (meetingInfo != null)
            {
                Console.WriteLine($">\tNew Meeting Found at: {meetingInfo.StartTime.ToLocalTime()}");

                /*Send an audio registration email enabling all unregistered users to enroll on DiScribe website */
                MeetingController.SendEmailsToAnyUnregisteredUsers(meetingInfo.AttendeesEmails, appConfig["DB_CONN_STR"]);


                Console.WriteLine($">\tScheduling dialer to dial in to meeting at {meetingInfo.StartTime}");

                //Kay: According to Oloff, this should not have an "await" in front, otherwise it will wait until the meeting finish before checking the inbox again.
                SchedulerController.Schedule(Run, meetingInfo, appConfig, meetingInfo.StartTime);//Schedule dialer-transcriber workflow as separate task
            }

            return(meetingInfo);
        }
예제 #2
0
        /// <summary>
        /// Listens for MS graph events occuring as a result of a meeting invite from Outlook.
        /// The bot schedules a Webex meeting if a valid meeting invite event is detected.
        /// </summary>
        /// <param name="appConfig"></param>
        /// <returns></returns>
        private static async Task <object?> CheckForGraphEvents(IConfigurationRoot appConfig)
        {
            MeetingInfo meetingInfo = null;

            Microsoft.Graph.Event inviteEvent;

            try
            {
                /*Attempt to get. latest event from bot's Outlook account.
                 * If there are no events, nothing will be scheduled. */
                inviteEvent = await EmailListener.GetEventAsync();

                await EmailListener.DeleteEventAsync(inviteEvent);

                /*Handle the invite.
                 * Assign the returned meeting info about the scheduled meeting or
                 * null if this is not an Outlook invite*/
                meetingInfo = await MeetingController.HandleInvite(inviteEvent, appConfig);
            }
            catch (Exception ex)
            {
                //throw new Exception($"Could not get any MS Graph events. Reason: {ex.Message}");
                Console.WriteLine($">\tCould not get any MS Graph events. Reason: {ex.Message}");
                return(null);
            }

            if (meetingInfo != null)
            {
                Console.WriteLine($">\tNew Meeting Found at: {meetingInfo.StartTime}");

                /*Send an audio registration email enabling all unregistered users to enroll on DiScribe website */
                MeetingController.SendEmailsToAnyUnregisteredUsers(meetingInfo.AttendeesEmails, appConfig["DB_CONN_STR"]);


                Console.WriteLine($">\tScheduling dialer to dial in to meeting at {meetingInfo.StartTime}");

                /*Convert start time and end time to the DiScribe bot time zone from the Webex host's time zone */
                var botStartTime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(meetingInfo.StartTime, meetingInfo.HostInfo.TimeZone, TimeZoneInfo.Local.Id);

                //Kay: According to Oloff, this should not have an "await" in front, otherwise it will wait until the meeting finish before checking the inbox again.
                SchedulerController.Schedule(Run, meetingInfo, appConfig, meetingInfo.StartTime);//Schedule dialer-transcriber workflow as separate task
            }
            return(meetingInfo);
        }