Пример #1
0
 // Token: 0x06001D50 RID: 7504 RVA: 0x00074AA8 File Offset: 0x00072CA8
 public SpeechRecognitionProcessor(HttpContext httpContext)
 {
     this.speechScenario = SpeechRecognitionProcessor.CreateSpeechRecognitionScenario(httpContext, out this.budget);
     this.HttpContext    = httpContext;
     this.parameters     = this.speechScenario.Parameters;
     this.userContext    = this.speechScenario.UserContext;
     this.maxAudioSize   = AppConfigLoader.GetConfigIntValue("SpeechRecognitionMaxAudioSize", 0, int.MaxValue, 32500);
 }
Пример #2
0
        // Token: 0x06001D57 RID: 7511 RVA: 0x00074C30 File Offset: 0x00072E30
        private static SpeechRecognitionScenarioBase CreateSpeechRecognitionScenario(HttpContext httpContext, out IStandardBudget budget)
        {
            ValidateArgument.NotNull(httpContext, "httpContext is null");
            budget = null;
            Exception ex = null;
            SpeechRecognitionScenarioBase result = null;

            try
            {
                Guid   guid = Guid.NewGuid();
                string text;
                MobileSpeechRecoRequestType mobileSpeechRecoRequestType;
                CultureInfo cultureInfo;
                ExTimeZone  exTimeZone;
                SpeechRecognitionProcessor.GetQueryStringParameters(httpContext.Request, out text, out mobileSpeechRecoRequestType, out cultureInfo, out exTimeZone);
                ExTraceGlobals.SpeechRecognitionTracer.TraceDebug(0L, "SpeechRecognitionProcessor.CreateSpeechRecognitionProcessor - requestId='{0}', tag='{1}', requestType='{2}', culture='{3}', timeZone='{4}'", new object[]
                {
                    guid,
                    text,
                    mobileSpeechRecoRequestType,
                    cultureInfo,
                    exTimeZone
                });
                Guid           guid2;
                Guid           guid3;
                OrganizationId organizationId;
                UserContext    userContext;
                SpeechRecognitionProcessor.GetUserIdentity(httpContext, out guid2, out guid3, out organizationId, out userContext);
                ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid, Guid, OrganizationId>(0L, "SpeechRecognitionProcessor.CreateSpeechRecognitionProcessor - userObjectGuid='{0}', tenantGuid='{1}', orgId='{2}'", guid2, guid3, organizationId);
                RequestParameters requestParameters = new RequestParameters(guid, text, mobileSpeechRecoRequestType, cultureInfo, exTimeZone, guid2, guid3, organizationId);
                switch (mobileSpeechRecoRequestType)
                {
                case MobileSpeechRecoRequestType.FindInGAL:
                case MobileSpeechRecoRequestType.FindInPersonalContacts:
                case MobileSpeechRecoRequestType.StaticGrammarsCombined:
                    throw new ArgumentOutOfRangeException("operation", mobileSpeechRecoRequestType, "Invalid parameter");

                case MobileSpeechRecoRequestType.FindPeople:
                    result = new FindPeopleSpeechRecognitionScenario(requestParameters, userContext);
                    break;

                case MobileSpeechRecoRequestType.CombinedScenarios:
                    result = new CombinedSpeechRecognitionScenario(requestParameters, userContext);
                    break;

                case MobileSpeechRecoRequestType.DaySearch:
                case MobileSpeechRecoRequestType.AppointmentCreation:
                    result = new SingleSpeechRecognitionScenario(requestParameters, userContext);
                    break;

                default:
                    ExAssert.RetailAssert(false, "Invalid request type '{0}'", new object[]
                    {
                        mobileSpeechRecoRequestType
                    });
                    break;
                }
                UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_SpeechRecoRequestParams, null, new object[]
                {
                    guid,
                    text,
                    mobileSpeechRecoRequestType,
                    cultureInfo,
                    exTimeZone,
                    guid2,
                    guid3,
                    organizationId
                });
                string      text2   = null;
                HttpRequest request = httpContext.Request;
                if (request.QueryString != null)
                {
                    text2 = request.QueryString.ToString();
                }
                if (request.Headers != null && !string.IsNullOrEmpty(request.Headers["X-OWA-CorrelationId"]))
                {
                    text2 = text2 + "." + request.Headers["X-OWA-CorrelationId"];
                }
                SpeechRecognitionProcessor.InitializeThrottlingBudget(userContext, text2, out budget);
            }
            catch (OverBudgetException ex2)
            {
                ex = ex2;
            }
            catch (ArgumentOutOfRangeException ex3)
            {
                ex = ex3;
            }
            catch (Exception ex4)
            {
                ex = ex4;
                ExWatson.SendReport(ex4, ReportOptions.None, null);
            }
            finally
            {
                if (ex != null)
                {
                    ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Exception>(0L, "SpeechRecognitionProcessor.CreateSpeechRecognitionProcessor - Exception='{0}'", ex);
                    UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_InvalidSpeechRecoRequest, null, new object[]
                    {
                        CommonUtil.ToEventLogString(ex)
                    });
                    SpeechRecognitionProcessor.SpeechHttpStatus status = SpeechRecognitionProcessor.MapInvalidRequestToHttpStatus(ex);
                    result = new InvalidRequestSpeechRecognitionScenario(status);
                }
            }
            return(result);
        }