// Token: 0x06001CCB RID: 7371 RVA: 0x00073480 File Offset: 0x00071680 public static void HandleRecoResult(string result, RequestParameters parameters, HttpContext httpContext, UserContext userContext, out string jsonResponse, out SpeechRecognitionProcessor.SpeechHttpStatus httpStatus) { jsonResponse = null; httpStatus = SpeechRecognitionProcessor.SpeechHttpStatus.Success; if (string.IsNullOrEmpty(result)) { return; } IMobileSpeechRecognitionResultHandler mobileSpeechRecognitionResultHandler = null; switch (parameters.RequestType) { case MobileSpeechRecoRequestType.FindPeople: mobileSpeechRecognitionResultHandler = new FindPeopleSpeechRecognitionResultHandler(parameters, userContext, httpContext); goto IL_95; case MobileSpeechRecoRequestType.CombinedScenarios: mobileSpeechRecognitionResultHandler = new CombinedScenarioRecognitionResultHandler(parameters, userContext, httpContext); goto IL_95; case MobileSpeechRecoRequestType.DaySearch: mobileSpeechRecognitionResultHandler = new DaySearchRecognitionResultHandler(parameters.TimeZone); goto IL_95; case MobileSpeechRecoRequestType.AppointmentCreation: mobileSpeechRecognitionResultHandler = new DateTimeandDurationRecognitionResultHandler(parameters.TimeZone); goto IL_95; } ExAssert.RetailAssert(false, "Invalid request type '{0}'", new object[] { parameters.RequestType }); IL_95: mobileSpeechRecognitionResultHandler.ProcessAndFormatSpeechRecognitionResults(result, out jsonResponse, out httpStatus); }
// 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: 0x06001CB2 RID: 7346 RVA: 0x00072D96 File Offset: 0x00070F96 private static Dictionary <string, PeopleSpeechPersonObject> RetrieveGALContactsFromXML(string result) { return(FindPeopleSpeechRecognitionResultHandler.RetrieveContactFromXMLHelper(result, "GALSearch", "SMTP", "ObjectGuid", delegate(Dictionary <string, PeopleSpeechPersonObject> galContactPersons, PeopleSpeechPersonObject personObject) { FindPeopleSpeechRecognitionResultHandler.AddContactToUniqueDictionary(personObject.GALLinkId, personObject, galContactPersons); })); }
// Token: 0x06001CB1 RID: 7345 RVA: 0x00072D4C File Offset: 0x00070F4C private static Dictionary <string, PeopleSpeechPersonObject> RetrieveUniquePersonalContactsFromXML(string result, List <string> galLinksToRemove) { return(FindPeopleSpeechRecognitionResultHandler.RetrieveContactFromXMLHelper(result, "PersonalContactSearch", "PersonId", "GALLinkID", delegate(Dictionary <string, PeopleSpeechPersonObject> personalContactPersons, PeopleSpeechPersonObject personObject) { FindPeopleSpeechRecognitionResultHandler.AddContactToUniqueDictionary(personObject.Identifier, personObject, personalContactPersons); galLinksToRemove.Add(personObject.GALLinkId); })); }
// Token: 0x06001CAD RID: 7341 RVA: 0x00072ACC File Offset: 0x00070CCC private static Persona GetPersonaFromUser(ADRecipient recipient) { Persona persona = new Persona(); persona.PersonaId = new ItemId(IdConverter.ADObjectIdToEwsId(recipient.Id), null); persona.DisplayName = recipient.DisplayName; EmailAddressWrapper emailAddressWrapper = new EmailAddressWrapper(); emailAddressWrapper.EmailAddress = recipient.PrimarySmtpAddress.ToString(); emailAddressWrapper.Name = recipient.PrimarySmtpAddress.ToString(); persona.EmailAddress = emailAddressWrapper; persona.EmailAddresses = new EmailAddressWrapper[] { emailAddressWrapper }; persona.Attributions = new Attribution[] { new Attribution("0", new ItemId(), WellKnownNetworkNames.GAL) { IsWritable = false, IsQuickContact = false, IsHidden = false, FolderId = null } }; IADOrgPerson iadorgPerson = recipient as IADOrgPerson; if (iadorgPerson != null) { persona.GivenName = iadorgPerson.FirstName; persona.CompanyName = iadorgPerson.Company; persona.Surname = iadorgPerson.LastName; persona.Title = iadorgPerson.Title; Microsoft.Exchange.Services.Core.Types.PhoneNumber phoneNumber = new Microsoft.Exchange.Services.Core.Types.PhoneNumber(); phoneNumber.Number = iadorgPerson.Phone; phoneNumber.Type = PersonPhoneNumberType.Business; persona.PhoneNumber = phoneNumber; persona.DisplayNames = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(persona.DisplayName); persona.GivenNames = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(persona.GivenName); persona.Surnames = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(persona.Surname); persona.CompanyNames = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(persona.CompanyName); persona.Titles = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(persona.Title); persona.OfficeLocations = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(iadorgPerson.Office); persona.Emails1 = FindPeopleSpeechRecognitionResultHandler.GetEmailAddressAttribValue(emailAddressWrapper); persona.BusinessPhoneNumbers = FindPeopleSpeechRecognitionResultHandler.GetPhoneNumberAttribValue(phoneNumber); } return(persona); }
// Token: 0x06001CB9 RID: 7353 RVA: 0x00073270 File Offset: 0x00071470 private List <Persona> GetPersonalContactPersonas(string result, out List <string> galLinksToRemove) { galLinksToRemove = new List <string>(); Dictionary <string, PeopleSpeechPersonObject> personalContactPersons = FindPeopleSpeechRecognitionResultHandler.RetrieveUniquePersonalContactsFromXML(result, galLinksToRemove); List <Persona> personas = new List <Persona>(personalContactPersons.Count); if (personalContactPersons.Count > 0) { CallContext callContext = null; try { callContext = FindPeopleSpeechRecognitionResultHandler.CreateAndSetCallContext(this.httpContext); this.userContext.LockAndReconnectMailboxSession(3000); ExchangeVersion.ExecuteWithSpecifiedVersion(ExchangeVersion.Exchange2012, delegate { ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <int>((long)this.GetHashCode(), "Creating Personas from Person Id, PersonId count:{0}", personalContactPersons.Count); foreach (string text in personalContactPersons.Keys) { PersonId personId = PersonId.Create(text); ItemId personaId = IdConverter.PersonaIdFromPersonId(this.userContext.MailboxSession.MailboxGuid, personId); Persona persona = Persona.LoadFromPersonaId(this.userContext.MailboxSession, null, personaId, FindPeopleSpeechRecognitionResultHandler.DefaultPersonaShape, null, null); persona.SpeechConfidence = personalContactPersons[text].Confidence; personas.Add(persona); } ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <int>((long)this.GetHashCode(), "Created Personas from Person Id, PersonId count:{0}", personalContactPersons.Count); }); } finally { if (this.userContext.MailboxSessionLockedByCurrentThread()) { this.userContext.UnlockAndDisconnectMailboxSession(); } FindPeopleSpeechRecognitionResultHandler.DisposeContext(callContext); } } return(personas); }
public void ProcessAndFormatSpeechRecognitionResults(string result, out string jsonResponse, out SpeechRecognitionProcessor.SpeechHttpStatus httpStatus) { ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>((long)this.GetHashCode(), "Entering CombinedScenariosRecognitionResultHandler.ProcessAndFormatSpeechRecognitionResults with results '{0}'", result); jsonResponse = null; httpStatus = SpeechRecognitionProcessor.SpeechHttpStatus.Success; MobileSpeechRecoResultType mobileSpeechRecoResultType = SpeechRecognitionUtils.ParseMobileScenarioXML(result); IMobileSpeechRecognitionResultHandler mobileSpeechRecognitionResultHandler = null; switch (mobileSpeechRecoResultType) { case MobileSpeechRecoResultType.DaySearch: mobileSpeechRecognitionResultHandler = new DaySearchRecognitionResultHandler(this.parameters.TimeZone); break; case MobileSpeechRecoResultType.AppointmentCreation: mobileSpeechRecognitionResultHandler = new DateTimeandDurationRecognitionResultHandler(this.parameters.TimeZone); break; case MobileSpeechRecoResultType.FindPeople: mobileSpeechRecognitionResultHandler = new FindPeopleSpeechRecognitionResultHandler(this.parameters, this.userContext, this.httpContext); break; case MobileSpeechRecoResultType.EmailPeople: mobileSpeechRecognitionResultHandler = new EmailPeopleSpeechRecognitionResultHandler(this.parameters, this.userContext, this.httpContext); break; case MobileSpeechRecoResultType.None: mobileSpeechRecognitionResultHandler = null; break; default: ExAssert.RetailAssert(false, "Invalid result type '{0}'", new object[] { mobileSpeechRecoResultType.ToString() }); break; } string text = string.Empty; CombinedScenarioRecoResult[] obj; if (mobileSpeechRecoResultType == MobileSpeechRecoResultType.None) { obj = new CombinedScenarioRecoResult[0]; } else { mobileSpeechRecognitionResultHandler.ProcessAndFormatSpeechRecognitionResults(result, out jsonResponse, out httpStatus); if (httpStatus != SpeechRecognitionProcessor.SpeechHttpStatus.Success) { return; } CombinedScenarioRecoResult combinedScenarioRecoResult = new CombinedScenarioRecoResult(); combinedScenarioRecoResult.RequestId = this.parameters.RequestId.ToString("N", CultureInfo.InvariantCulture); text = this.GetResultTextForLogging(result); combinedScenarioRecoResult.Text = text; combinedScenarioRecoResult.JsonResponse = jsonResponse; combinedScenarioRecoResult.ResultType = CombinedScenarioRecoResult.MapSpeechRecoResultTypeToCombinedRecoResultType(mobileSpeechRecoResultType); obj = new CombinedScenarioRecoResult[] { combinedScenarioRecoResult }; } jsonResponse = CombinedScenarioRecoResult.JsonSerialize(obj); this.CollectAndLogStatisticsInformation(mobileSpeechRecoResultType, text); ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>((long)this.GetHashCode(), "Return json from CombinedScenarioResult: '{0}'", jsonResponse); }