com.amazon.speech.speechlet.SpeechletException Java Examples

The following examples show how to use com.amazon.speech.speechlet.SpeechletException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StarwarsSpeechlet.java    From chatbot with Apache License 2.0 6 votes vote down vote up
@Override
public SpeechletResponse onIntent(final IntentRequest request, final Session session)
        throws SpeechletException {
    log.info("onIntent requestId={}, sessionId={}", request.getRequestId(),
            session.getSessionId());

    Intent intent = request.getIntent();
    String intentName = (intent != null) ? intent.getName() : null;
    String character = intent.getSlot("character").getValue();

    if (StarWarsIntent.QUOTES_INTENT.equals(intentName)) {
        return getQuotesResponse(character);
    } else if (StarWarsIntent.PLANET_INTENT.equals(intentName)) {
        return getPlanetResponse(character);
    } else if (StarWarsIntent.LIGHTSABER_INTENT.equals(intentName)) {
        return getLightsaberResponse(character);
    } else if (StarWarsIntent.FORCE_SENSITIVE_INTENT.equals(intentName)) {
        return getForceSensitiveResponse(character);
    } else if (StarWarsIntent.FORCE_SIDE_INTENT.equals(intentName)) {
        return getForceSideResponse(character);
    } else {
        throw new SpeechletException("Invalid Intent: " + intentName);
    }
}
 
Example #2
Source File: HelloWorldSpeechlet.java    From alexa-skill-java with Apache License 2.0 5 votes vote down vote up
@Override
public void onSessionStarted(final SessionStartedRequest request, final Session session)
        throws SpeechletException {
    log.info("onSessionStarted requestId={}, sessionId={}", request.getRequestId(),
            session.getSessionId());
    // any initialization logic goes here
}
 
Example #3
Source File: HelloWorldSpeechlet.java    From alexa-skill-java with Apache License 2.0 5 votes vote down vote up
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
        throws SpeechletException {
    log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
            session.getSessionId());
    return getWelcomeResponse();
}
 
Example #4
Source File: HelloWorldSpeechlet.java    From alexa-skill-java with Apache License 2.0 5 votes vote down vote up
@Override
public void onSessionEnded(final SessionEndedRequest request, final Session session)
        throws SpeechletException {
    log.info("onSessionEnded requestId={}, sessionId={}", request.getRequestId(),
            session.getSessionId());
    // any cleanup logic goes here
}
 
Example #5
Source File: StarwarsSpeechlet.java    From chatbot with Apache License 2.0 5 votes vote down vote up
@Override
public void onSessionStarted(final SessionStartedRequest request, final Session session)
        throws SpeechletException {
    log.info("onSessionStarted requestId={}, sessionId={}", request.getRequestId(),
            session.getSessionId());
    // any initialization logic goes here
}
 
Example #6
Source File: StarwarsSpeechlet.java    From chatbot with Apache License 2.0 5 votes vote down vote up
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
        throws SpeechletException {
    log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
            session.getSessionId());
    return getWelcomeResponse();
}
 
Example #7
Source File: StarwarsSpeechlet.java    From chatbot with Apache License 2.0 5 votes vote down vote up
@Override
public void onSessionEnded(final SessionEndedRequest request, final Session session)
        throws SpeechletException {
    log.info("onSessionEnded requestId={}, sessionId={}", request.getRequestId(),
            session.getSessionId());
    // any cleanup logic goes here
}
 
Example #8
Source File: EchoQuerySpeechlet.java    From EchoQuery with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onSessionStarted(
    final SessionStartedRequest request, final Session session)
    throws SpeechletException {
  log.info("onSessionStarted requestId={}, sessionId={}",
      request.getRequestId(), session.getSessionId());
}
 
Example #9
Source File: EchoQuerySpeechlet.java    From EchoQuery with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SpeechletResponse onLaunch(
    final LaunchRequest request, final Session session)
    throws SpeechletException {
  log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
      session.getSessionId());

  return Response.welcome(session);
}
 
Example #10
Source File: EchoQuerySpeechlet.java    From EchoQuery with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SpeechletResponse onIntent(
    final IntentRequest request, final Session session)
    throws SpeechletException {
  log.info("onIntent requestId={}, sessionId={}", request.getRequestId(),
      session.getSessionId());

  Intent intent = request.getIntent();
  String intentName = intent.getName();

  // Route the intent to the proper handlers.
  switch(intentName) {
    case "QueryIntent":
      return queryHandler.respond(intent, session);
    case "RefineIntent":
      return refineHandler.respond(intent, session);
    case "ClarifyIntent":
      return clarifyHandler.respond(intent, session);
    case "PlotIntent":
      return plotHandler.respond(intent, session);
    case "ClearIntent":
      return clearHandler.respond(intent, session);
    case "AMAZON.HelpIntent":
      return helpHandler.respond(intent, session);
    case "AMAZON.StopIntent":
      return Response.bye(session);
    case "AMAZON.CancelIntent":
      return Response.bye(session);
    case "AMAZON.NoIntent":
      return Response.bye(session);
    default:
      throw new SpeechletException("Invalid Intent: " + intentName);
  }
}
 
Example #11
Source File: EchoQuerySpeechlet.java    From EchoQuery with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onSessionEnded(
    final SessionEndedRequest request, final Session session)
    throws SpeechletException {
  log.info("onSessionEnded requestId={}, sessionId={}",
      request.getRequestId(), session.getSessionId());
}
 
Example #12
Source File: ProxySpeechlet.java    From echo_proxy with MIT License 4 votes vote down vote up
@Override
public void onSessionStarted(SessionStartedRequest sessionStartedRequest, Session session) throws SpeechletException {
  handleRequest(sessionStartedRequest, session);
}
 
Example #13
Source File: ProxySpeechlet.java    From echo_proxy with MIT License 4 votes vote down vote up
@Override
public SpeechletResponse onLaunch(LaunchRequest launchRequest, Session session) throws SpeechletException {
  return handleRequest(launchRequest, session);
}
 
Example #14
Source File: ProxySpeechlet.java    From echo_proxy with MIT License 4 votes vote down vote up
@Override
public SpeechletResponse onIntent(IntentRequest intentRequest, Session session) throws SpeechletException {
  return handleRequest(intentRequest, session);
}
 
Example #15
Source File: ProxySpeechlet.java    From echo_proxy with MIT License 4 votes vote down vote up
@Override
public void onSessionEnded(SessionEndedRequest sessionEndedRequest, Session session) throws SpeechletException {
  handleRequest(sessionEndedRequest, session);
}