private async Task <ISpeechletResponse> HandleStandardRequestAsync(SpeechletRequest request, Session session, Context context) { if (session != null) { // Do session management prior to calling OnSessionStarted and OnIntentAsync // to allow dev to change session values if behavior is not desired DoSessionManagement(request as IntentRequest, session); if (session.IsNew) { var sessionStartedRequest = new SessionStartedRequest(request); (speechlet as ISpeechletWithContext)?.OnSessionStarted(sessionStartedRequest, session, context); await(speechlet as ISpeechletWithContextAsync)?.OnSessionStartedAsync(sessionStartedRequest, session, context); (speechlet as ISpeechlet)?.OnSessionStarted(sessionStartedRequest, session); await(speechlet as ISpeechletAsync)?.OnSessionStartedAsync(sessionStartedRequest, session); } } // process launch request if (request is LaunchRequest) { return((speechlet as ISpeechletWithContext)?.OnLaunch(request as LaunchRequest, session, context) ?? await(speechlet as ISpeechletWithContextAsync)?.OnLaunchAsync(request as LaunchRequest, session, context) ?? (speechlet as ISpeechlet)?.OnLaunch(request as LaunchRequest, session) ?? await(speechlet as ISpeechletAsync)?.OnLaunchAsync(request as LaunchRequest, session)); } // process intent request else if (request is IntentRequest) { return((speechlet as ISpeechletWithContext)?.OnIntent(request as IntentRequest, session, context) ?? await(speechlet as ISpeechletWithContextAsync)?.OnIntentAsync(request as IntentRequest, session, context) ?? (speechlet as ISpeechlet)?.OnIntent(request as IntentRequest, session) ?? await(speechlet as ISpeechletAsync)?.OnIntentAsync(request as IntentRequest, session)); } // process session ended request else if (request is SessionEndedRequest) { (speechlet as ISpeechletWithContext)?.OnSessionEnded(request as SessionEndedRequest, session, context); await(speechlet as ISpeechletWithContextAsync)?.OnSessionEndedAsync(request as SessionEndedRequest, session, context); (speechlet as ISpeechlet)?.OnSessionEnded(request as SessionEndedRequest, session); await(speechlet as ISpeechletAsync)?.OnSessionEndedAsync(request as SessionEndedRequest, session); } return(null); }
protected SpeechletRequest(SpeechletRequest other) { RequestId = other.RequestId; Timestamp = other.Timestamp; Locale = other.Locale; }