// Token: 0x060019B0 RID: 6576 RVA: 0x0005AE54 File Offset: 0x00059054
        protected void LogException(Exception ex, string userSipUri, string description)
        {
            if (!string.IsNullOrEmpty(userSipUri))
            {
                AutodiscoverCache.IncrementFailureCount(userSipUri);
                base.CallContext.ProtocolLog.Set(CreateOnlineMeetingMetadata.CacheOperation, AutodiscoverCacheOperation.IncrementFailureCounter.ToString());
            }
            StringBuilder stringBuilder = new StringBuilder(description);

            if (ex != null)
            {
                if (ex is HttpOperationException)
                {
                    HttpOperationException ex2 = ex as HttpOperationException;
                    if (ex2.HttpResponse != null)
                    {
                        base.CallContext.ProtocolLog.Set(CreateOnlineMeetingMetadata.ResponseHeaders, ex2.HttpResponse.GetResponseHeadersAsString());
                        base.CallContext.ProtocolLog.Set(CreateOnlineMeetingMetadata.ResponseBody, ex2.HttpResponse.GetResponseBodyAsString());
                    }
                    stringBuilder.Append(((HttpOperationException)ex).ToLogString());
                }
                else if (ex is AggregateException)
                {
                    stringBuilder.Append(((AggregateException)ex).ToLogString());
                }
                else
                {
                    stringBuilder.Append(UcwaConfigurationUtilities.BuildFailureLogString(ex));
                }
            }
            this.LogAndTraceError(stringBuilder.ToString());
        }
示例#2
0
 protected override UcwaUserConfiguration InternalExecute()
 {
     return(UcwaConfigurationUtilities.GetUcwaUserConfiguration(this.sipUri, base.CallContext));
 }
示例#3
0
        // Token: 0x060019C1 RID: 6593 RVA: 0x0005B6AC File Offset: 0x000598AC
        protected override OnlineMeetingType ProcessOnlineMeetingResult(UserContext userContext, OnlineMeetingResult result)
        {
            OnlineMeetingType result2;

            using (this.CalendarItem)
            {
                if (this.CalendarItem == null)
                {
                    result2 = OnlineMeetingType.CreateFailedOnlineMeetingType("Unable to find existing item corresponding to id: " + this.itemId.Id);
                }
                else
                {
                    this.CalendarItem.OpenAsReadWrite();
                    this.CalendarItem.OnlineMeetingConfLink     = result.OnlineMeeting.MeetingUri;
                    this.CalendarItem.OnlineMeetingExternalLink = result.OnlineMeeting.WebUrl;
                    this.CalendarItem.OnlineMeetingInternalLink = string.Empty;
                    this.CalendarItem.UCOpenedConferenceID      = Guid.NewGuid().ToString("B");
                    this.CalendarItem.ConferenceTelURI          = OutlookAddinAdapter.GetConferenceTelUri(result);
                    Capabilities ucCapabilities = OutlookAddinAdapter.GetUcCapabilities(result, userContext.UserCulture);
                    try
                    {
                        this.CalendarItem.UCCapabilities = OutlookAddinAdapter.Serialize(ucCapabilities);
                    }
                    catch (InvalidOperationException ex)
                    {
                        base.LogAndTraceError("An error occured while serializing UCCapabilities: " + UcwaConfigurationUtilities.BuildFailureLogString(ex));
                        return(OnlineMeetingType.CreateFailedOnlineMeetingType("An error occured while serializing UCCapabilities"));
                    }
                    try
                    {
                        this.CalendarItem.UCInband = OutlookAddinAdapter.Serialize(OutlookAddinAdapter.GetUCInband(result));
                    }
                    catch (InvalidOperationException ex2)
                    {
                        base.LogAndTraceError("An error occured while serializing UCInband: " + UcwaConfigurationUtilities.BuildFailureLogString(ex2));
                        return(OnlineMeetingType.CreateFailedOnlineMeetingType("An error occured while serializing UCInband"));
                    }
                    try
                    {
                        this.CalendarItem.UCMeetingSetting = OutlookAddinAdapter.Serialize(OutlookAddinAdapter.GetUCMeetingSetting(result));
                    }
                    catch (InvalidOperationException ex3)
                    {
                        base.LogAndTraceError("An error occured while serializing UCMeetingSetting: " + UcwaConfigurationUtilities.BuildFailureLogString(ex3));
                        return(OnlineMeetingType.CreateFailedOnlineMeetingType("An error occured while serializing UCMeetingSetting"));
                    }
                    try
                    {
                        PropertyDefinitionStream updatedOutlookUserPropsPropDefStream = OutlookAddinAdapter.GetUpdatedOutlookUserPropsPropDefStream(this.CalendarItem.OutlookUserPropsPropDefStream);
                        this.CalendarItem.OutlookUserPropsPropDefStream = updatedOutlookUserPropsPropDefStream.GetByteArray();
                    }
                    catch (EndOfStreamException ex4)
                    {
                        base.LogAndTraceError("[ProcessOnlineMeetingResult] A read error occurred when parsing OutlookUserPropsPropDefStream: " + UcwaConfigurationUtilities.BuildFailureLogString(ex4));
                        return(OnlineMeetingType.CreateFailedOnlineMeetingType("A read error occured when parsing OutlookUserPropsPropDefStream"));
                    }
                    OnlineMeetingType          onlineMeetingType = CreateOnlineMeeting.CreateOnlineMeetingTypeFromOnlineMeetingResult(result, ucCapabilities, base.CallContext.ProtocolLog);
                    ConcatenatedIdAndChangeKey concatenatedId    = IdConverter.GetConcatenatedId(this.CalendarItem.Id, new MailboxId(this.MailboxSession), null);
                    onlineMeetingType.ItemId = new ItemId(concatenatedId.Id, concatenatedId.ChangeKey);
                    this.CalendarItem.Save(SaveMode.NoConflictResolutionForceSave);
                    result2 = onlineMeetingType;
                }
            }
            return(result2);
        }
示例#4
0
        // Token: 0x060019C9 RID: 6601 RVA: 0x0005BE64 File Offset: 0x0005A064
        private static OnlineMeetingType CreateOnlineMeetingTypeFromOnlineMeetingResult(OnlineMeetingResult onlineMeetingResult, Capabilities capabilities, RequestDetailsLogger logger)
        {
            List <Exception>  list = new List <Exception>();
            OnlineMeetingType onlineMeetingType = new OnlineMeetingType();

            onlineMeetingType.HelpUrl              = onlineMeetingResult.CustomizationValues.InvitationHelpUrl;
            onlineMeetingType.LegalUrl             = onlineMeetingResult.CustomizationValues.InvitationLegalUrl;
            onlineMeetingType.CustomFooterText     = onlineMeetingResult.CustomizationValues.InvitationFooterText;
            onlineMeetingType.ExternalDirectoryUri = onlineMeetingResult.DialIn.ExternalDirectoryUri;
            onlineMeetingType.InternalDirectoryUri = onlineMeetingResult.DialIn.InternalDirectoryUri;
            onlineMeetingType.LogoUrl              = onlineMeetingResult.CustomizationValues.InvitationLogoUrl;
            onlineMeetingType.WebUrl = onlineMeetingResult.OnlineMeeting.WebUrl;
            try
            {
                onlineMeetingType.AccessLevel = CreateOnlineMeeting.ConvertAccessLevel(onlineMeetingResult.OnlineMeeting.Accesslevel);
            }
            catch (ArgumentException item)
            {
                list.Add(item);
            }
            try
            {
                onlineMeetingType.LobbyBypass = CreateOnlineMeeting.ConvertLobbyBypass(onlineMeetingResult.OnlineMeeting.PstnUserLobbyBypass);
            }
            catch (ArgumentException item2)
            {
                list.Add(item2);
            }
            try
            {
                onlineMeetingType.Presenters = CreateOnlineMeeting.ConvertPresenters(onlineMeetingResult.OnlineMeeting.AutomaticLeaderAssignment);
            }
            catch (ArgumentException item3)
            {
                list.Add(item3);
            }
            if (capabilities == null)
            {
                return(onlineMeetingType);
            }
            if (onlineMeetingResult.DialIn.IsAudioConferenceProviderEnabled)
            {
                onlineMeetingType.AcpInformation = new AcpInformationType();
                onlineMeetingType.AcpInformation.ParticipantPassCode = onlineMeetingResult.DialIn.ParticipantPassCode;
                onlineMeetingType.AcpInformation.TollNumber          = onlineMeetingResult.DialIn.TollNumber;
                onlineMeetingType.AcpInformation.TollFreeNumbers     = onlineMeetingResult.DialIn.TollFreeNumbers;
            }
            else
            {
                onlineMeetingType.ConferenceId = onlineMeetingResult.OnlineMeeting.PstnMeetingId;
                List <DialInNumberType> list2 = new List <DialInNumberType>();
                foreach (Region region in capabilities.Regions)
                {
                    foreach (AccessNumber accessNumber in region.AccessNumbers)
                    {
                        DialInNumberType dialInNumberType = new DialInNumberType();
                        dialInNumberType.RegionName = region.Name;
                        dialInNumberType.Number     = accessNumber.Number;
                        try
                        {
                            dialInNumberType.Language = new CultureInfo(accessNumber.LanguageID).NativeName;
                        }
                        catch (CultureNotFoundException ex)
                        {
                            ExTraceGlobals.OnlineMeetingTracer.TraceError <int, string>(0, 0L, "CreateOnlineMeeting::CreateOnlineMeetingTypeFromOnlineMeetingResult. CultureNotFoundException occurred when creating CultureInfo from LanguageId '{0}'. Exception:'{1}'.  ", accessNumber.LanguageID, UcwaConfigurationUtilities.BuildFailureLogString(ex));
                            list.Add(new OwaException(string.Format("Unable to create cultureInfo corresponding to lcid '{0}' for region '{1}' with number '{2}'", accessNumber.LanguageID, region.Name, accessNumber.Number), ex));
                        }
                        list2.Add(dialInNumberType);
                    }
                }
                onlineMeetingType.Numbers = list2.ToArray();
            }
            if (list.Count > 0)
            {
                StringBuilder stringBuilder = new StringBuilder();
                foreach (Exception ex2 in list)
                {
                    stringBuilder.AppendFormat("{0}::", UcwaConfigurationUtilities.BuildFailureLogString(ex2));
                }
                logger.Set(CreateOnlineMeetingMetadata.Exceptions, stringBuilder.ToString());
            }
            return(onlineMeetingType);
        }
示例#5
0
        // Token: 0x060019C5 RID: 6597 RVA: 0x0005BCD0 File Offset: 0x00059ED0
        private CalendarItem BindToItem(ItemId itemId)
        {
            StoreId id;

            try
            {
                id = StoreId.EwsIdToStoreObjectId(itemId.Id);
            }
            catch (InvalidIdMalformedException ex)
            {
                base.LogAndTraceError(string.Format("[GetCalendarItem] Invalid itemId '{0}' - exception: {1}", itemId.Id, UcwaConfigurationUtilities.BuildFailureLogString(ex)));
                return(null);
            }
            CalendarItem result = null;

            try
            {
                ExTraceGlobals.OnlineMeetingTracer.TraceInformation <string>(0, 0L, "[CreateOnlineMeeting.GetCalendarItem] Trying to bind to item with provided ItemId '{0}'", itemId.Id);
                result = CalendarItem.Bind(this.MailboxSession, id);
            }
            catch (ArgumentException ex2)
            {
                base.LogAndTraceError(string.Format("[GetCalendarItem] Unable to bind to item with provided ItemId '{0}'; Exception: {1}", itemId.Id, UcwaConfigurationUtilities.BuildFailureLogString(ex2)));
            }
            catch (ObjectNotFoundException ex3)
            {
                base.LogAndTraceError(string.Format("[GetCalendarItem] Unable to find item with provided ItemId '{0}'; Exception: {1}", itemId.Id, UcwaConfigurationUtilities.BuildFailureLogString(ex3)));
            }
            return(result);
        }
        // Token: 0x060019AD RID: 6573 RVA: 0x0005AB7C File Offset: 0x00058D7C
        protected override OnlineMeetingType InternalExecute()
        {
            this.SetDefaultValuesForOptics();
            UserContext userContext = UserContextManager.GetUserContext(base.CallContext.HttpContext, base.CallContext.EffectiveCaller, true);

            if (string.Compare(userContext.SipUri, this.sipUri, StringComparison.OrdinalIgnoreCase) != 0)
            {
                base.CallContext.ProtocolLog.Set(CreateOnlineMeetingMetadata.ManagerSipUri, ExtensibleLogger.FormatPIIValue(this.sipUri));
            }
            if (userContext.ExchangePrincipal.MailboxInfo.OrganizationId != null && userContext.ExchangePrincipal.MailboxInfo.OrganizationId.OrganizationalUnit != null)
            {
                base.CallContext.ProtocolLog.Set(CreateOnlineMeetingMetadata.Organization, userContext.ExchangePrincipal.MailboxInfo.OrganizationId.OrganizationalUnit.Name);
            }
            UcwaUserConfiguration ucwaUserConfiguration = UcwaConfigurationUtilities.GetUcwaUserConfiguration(this.sipUri, base.CallContext);

            if (!ucwaUserConfiguration.IsUcwaSupported)
            {
                base.CallContext.ProtocolLog.Set(CreateOnlineMeetingMetadata.IsUcwaSupported, bool.FalseString);
                string errorString = string.Format("[InternalExecute] Attempted to create an online meeting for a non-UCWA supported user; autodiscover returned UcwaUrl: '{0}', DiagnosticInfo: '{1}'", ucwaUserConfiguration.UcwaUrl, ucwaUserConfiguration.DiagnosticInfo);
                this.LogAndTraceError(errorString);
                return(OnlineMeetingType.CreateFailedOnlineMeetingType("User is not UCWA enabled"));
            }
            if (!this.ShoudlMeetingBeCreated())
            {
                return(OnlineMeetingType.CreateFailedOnlineMeetingType("Item already has an online meeting associated to it."));
            }
            OAuthCredentials oauthCredential;

            try
            {
                oauthCredential = UcwaConfigurationUtilities.GetOAuthCredential(this.sipUri);
                oauthCredential.ClientRequestId = new Guid?(Guid.NewGuid());
                base.CallContext.ProtocolLog.Set(CreateOnlineMeetingMetadata.OAuthCorrelationId, oauthCredential.ClientRequestId.Value.ToString());
            }
            catch (OwaException ex)
            {
                this.LogAndTraceError("An error occurred while obtaining OAuth Credential: " + UcwaConfigurationUtilities.BuildFailureLogString(ex));
                return(OnlineMeetingType.CreateFailedOnlineMeetingType("An error occurred while obtaining OAuth credential"));
            }
            Task <OnlineMeetingResult> task = this.CreateLyncOnlineMeeting(ucwaUserConfiguration.UcwaUrl, oauthCredential, userContext.UserCulture);

            base.CallContext.ProtocolLog.Set(CreateOnlineMeetingMetadata.IsTaskCompleted, task.IsCompleted.ToString());
            if (task.IsFaulted)
            {
                task.Exception.Flatten().Handle(new Func <Exception, bool>(this.HandleCreateOnlineMeetingTaskException));
                return(OnlineMeetingType.CreateFailedOnlineMeetingType("An error occured while calling UCWA to create the meeting"));
            }
            if (task.Result == null)
            {
                this.LogAndTraceError("Result from call to UCWA is null");
                return(OnlineMeetingType.CreateFailedOnlineMeetingType("Unable to create the meeting"));
            }
            if (task.Result.OnlineMeeting.WebUrl == "")
            {
                return(OnlineMeetingType.CreateFailedOnlineMeetingType("Unable to create the meeting"));
            }
            this.UpdateOpticsLog(task.Result);
            OnlineMeetingType result = this.ProcessOnlineMeetingResult(userContext, task.Result);

            this.DiposeObjectsIfNeeded();
            return(result);
        }
示例#7
0
        public static UcwaUserConfiguration GetUcwaUserConfiguration(string sipUri, CallContext callContext)
        {
            callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.IsTaskCompleted, bool.FalseString);
            callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.IsUcwaSupported, bool.FalseString);
            UcwaUserConfiguration ucwaUserConfiguration = new UcwaUserConfiguration();

            ucwaUserConfiguration.SipUri = sipUri;
            if (string.IsNullOrEmpty(sipUri))
            {
                callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.IsTaskCompleted, bool.TrueString);
                throw new OwaInvalidRequestException("No sipUri specified");
            }
            UserContext userContext = UserContextManager.GetUserContext(callContext.HttpContext, callContext.EffectiveCaller, true);

            if (string.Compare(userContext.SipUri, sipUri, StringComparison.OrdinalIgnoreCase) != 0)
            {
                callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.ManagerSipUri, ExtensibleLogger.FormatPIIValue(sipUri));
            }
            if (userContext.ExchangePrincipal.MailboxInfo.OrganizationId != null && userContext.ExchangePrincipal.MailboxInfo.OrganizationId.OrganizationalUnit != null)
            {
                callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.Organization, userContext.ExchangePrincipal.MailboxInfo.OrganizationId.OrganizationalUnit.Name);
            }
            OAuthCredentials oauthCredential;

            try
            {
                oauthCredential = UcwaConfigurationUtilities.GetOAuthCredential(sipUri);
                oauthCredential.ClientRequestId = new Guid?(Guid.NewGuid());
                callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.OAuthCorrelationId, oauthCredential.ClientRequestId.Value.ToString());
            }
            catch (OwaException ex)
            {
                string text = UcwaConfigurationUtilities.BuildFailureLogString(ex);
                callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.Exceptions, text);
                ExTraceGlobals.OnlineMeetingTracer.TraceError <string>(0L, "[UcwaConfigurationUtilities.GetUcwaUserConfiguration] An error occurred while obtaining OAuth credential; Exception: {0}", text);
                ucwaUserConfiguration.DiagnosticInfo = text;
                return(ucwaUserConfiguration);
            }
            AutodiscoverResult ucwaDiscoveryUrl = AutodiscoverWorker.GetUcwaDiscoveryUrl(sipUri, oauthCredential);

            callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.AuthenticatedLyncAutodiscoverServer, ucwaDiscoveryUrl.AuthenticatedLyncAutodiscoverServer);
            callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.IsAuthdServerFromCache, ucwaDiscoveryUrl.IsAuthdServerFromCache ? bool.TrueString : bool.FalseString);
            callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.IsUcwaUrlFromCache, ucwaDiscoveryUrl.IsUcwaUrlFromCache ? bool.TrueString : bool.FalseString);
            callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.UnauthenticatedRedirectHops, string.Join(";", ucwaDiscoveryUrl.UnauthenticatedRedirects));
            callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.AuthenticatedRedirectHops, string.Join(";", ucwaDiscoveryUrl.AuthenticatedRedirects));
            callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.WorkerExceptions, ucwaDiscoveryUrl.BuildFailureString());
            if (!ucwaDiscoveryUrl.IsOnlineMeetingEnabled)
            {
                ExTraceGlobals.OnlineMeetingTracer.TraceInformation(0, 0L, "[UcwaConfigurationUtilities.GetUcwaUserConfiguration] Online meetings are not enabled in this topology");
                ucwaUserConfiguration.DiagnosticInfo = "Online meetings not enabled on the server";
                return(ucwaUserConfiguration);
            }
            if (ucwaDiscoveryUrl.HasError)
            {
                Exception     exception     = ucwaDiscoveryUrl.Error.Exception;
                StringBuilder stringBuilder = new StringBuilder(ucwaDiscoveryUrl.Error.FailureStep.ToString() + "_");
                stringBuilder.Append(UcwaConfigurationUtilities.BuildFailureLogString(exception));
                stringBuilder.Append(ucwaDiscoveryUrl.Error.ResponseFailureReason ?? string.Empty);
                string text2 = stringBuilder.ToString();
                callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.Exceptions, text2);
                callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.RequestHeaders, ucwaDiscoveryUrl.Error.RequestHeaders);
                callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.ResponseHeaders, ucwaDiscoveryUrl.Error.ResponseHeaders);
                callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.ResponseBody, ucwaDiscoveryUrl.Error.ResponseBody);
                if (ucwaDiscoveryUrl.IsAuthdServerFromCache)
                {
                    AutodiscoverCache.InvalidateDomain(OnlineMeetingHelper.GetSipDomain(sipUri));
                    callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.CacheOperation, AutodiscoverCacheOperation.InvalidateDomain.ToString());
                }
                ExTraceGlobals.OnlineMeetingTracer.TraceError <string>(0L, "[UcwaConfigurationUtilities.GetUcwaUserConfiguration] An error occured while fetching UCWA configuration; Exception: {0}", text2);
                ucwaUserConfiguration.DiagnosticInfo = text2;
                return(ucwaUserConfiguration);
            }
            callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.ResponseBody, ucwaDiscoveryUrl.ResponseBody);
            ucwaUserConfiguration.IsUcwaSupported = ucwaDiscoveryUrl.IsUcwaSupported;
            ucwaUserConfiguration.UcwaUrl         = ucwaDiscoveryUrl.UcwaDiscoveryUrl;
            callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.IsTaskCompleted, bool.TrueString);
            if (ucwaUserConfiguration.IsUcwaSupported)
            {
                callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.IsUcwaSupported, bool.TrueString);
                callContext.ProtocolLog.Set(GetUcwaUserConfigurationMetaData.UcwaUrl, ucwaUserConfiguration.UcwaUrl);
            }
            return(ucwaUserConfiguration);
        }