public override SpeechletResponse OnIntent(IntentRequest request, Session session) { logger.Log($"OnIntent called for session {session.SessionId}"); try { var intent = request.Intent; var intentName = intent?.Name; logger.Log($"Intent name: {intentName}"); if ("ChordIntent".Equals(intentName)) { var chordFinder = new ChordFinder(); var chordProcessor = new ChordProcessor(logger, chordFinder); return(chordProcessor.ProcessChord(intent.Slots["chord"]?.Value)); } if ("AMAZON.CancelIntent".Equals(intentName) || "AMAZON.StopIntent".Equals(intentName)) { return(SsmlResponseFactory.Create("<say-as interpret-as='interjection'>okey dokey.</say-as>", true)); } } catch (Exception e) { logger.Log($"About to fail with error {e}"); throw; } logger.Log("About to fail"); throw new SpeechletException("Invalid Intent"); }
private SpeechletResponse CreateChordResponse(string chordName) { var chord = chordFinder.GetChord(chordName); logger.Log($"Notes are : {string.Join(", ", chord.Notes)}"); var ssml = $"Notes in {chord.Name} <break strength='medium'/> are <break strength='medium'/> {chord.ToNotesSsml()}"; return(SsmlResponseFactory.Create(ssml, false)); }