Estoy tratando de terminar mi aplicación Alexa para música, pero por alguna razón, la parte de detener y cancelar de mi aplicación no funciona. Este es mi código (parte de él):
(la parada asíncrona es lo que se llama cuando se llama a controller.stop)
const CancelAndStopIntentHandler = { canHandle(handlerInput) { return ( Alexa.getRequestType(handlerInput.requestEnvelope) === "IntentRequest" && (Alexa.getIntentName(handlerInput.requestEnvelope) === "AMAZON.CancelIntent" || Alexa.getIntentName(handlerInput.requestEnvelope) === "AMAZON.StopIntent" || Alexa.getIntentName(handlerInput.requestEnvelope) === "AMAZON.PauseIntent") ); }, handle(handlerInput) { console.log("CancelAndStopIntentHandler"); handlerInput.responseBuilder.speak("Okay") return controller.stop(handlerInput, "okay"); //Goodbye!"); }, }; ------------------------------------------------------------------------- async stop(handlerInput, message) { var device_id = handlerInput.requestEnvelope.context.System.device.deviceId; var info = await getstuffindb(device_id); console.log(info.length); var deviceMap = JSON.parse(info.devicemap); deviceMap[device_id]["is_playing"]=false; if (deviceMap[device_id]) { deviceMap[device_id]["g_offset"] = handlerInput.requestEnvelope.context.AudioPlayer.offsetInMilliseconds; console.log('Stopped at offset', deviceMap[device_id]["g_offset"]); } await insertintodb(device_id, JSON.stringify(deviceMap), device_id); return handlerInput.responseBuilder .speak(message) .withShouldEndSession(true) .addAudioPlayerStopDirective() .getResponse(); },