【问题标题】:Reponse object not working, What is wrong here?响应对象不起作用,这里有什么问题?
【发布时间】:2017-02-22 21:42:14
【问题描述】:

我已经设置了一个 php 应用程序来侦听 alexa 请求并生成响应。测试门户并没有真正给你很多反馈,只是它不起作用。

亚马逊正在发送什么。

{
"session": {
    "sessionId": "SessionId.here",
    "application": {
        "applicationId": "amzn1.ask.skill.here"
    },
    "attributes": {},
    "user": {
      "userId": "amzn1.ask.account.here"
    },
    "new": true
    },
    "request": {
        "type": "IntentRequest",
        "requestId": "EdwRequestId.here",
        "locale": "en-US",
        "timestamp": "2017-02-22T21:33:26Z",
        "intent": {
          "name": "PlayTheStream",
          "slots": {}
        }
    },
    "version": "1.0"
}

我的回答是这样的。

{
  "version": "1.0",
  "response": {
    "outputSpeech": {
      "type": "PlainText",
      "text": "Now streaming this stream"
    },
    "card": {
      "type": "Simple",
      "title": "Play Audio",
      "content": "Playing the requested stream."
    },
    "directives": {
      "type": "AudioPlayer.Play",
      "playBehavior": "ENQUEUE",
      "audioItem": {
        "stream": {
          "token": "this-is-the-audio-token",
          "url": "http://functionalstream.com/playlist.m3u",
          "offsetInMilliseconds": 0
        }
      }
    }
  },
  "shouldEndSession": true
}

响应标头

cache-control →no-cache, private
content-type →application/json
date →Wed, 22 Feb 2017 21:33:10 GMT
server →nginx/1.11.2
status →200
x-content-type-options →nosniff
x-frame-options →SAMEORIGIN
x-xss-protection →1; mode=block

【问题讨论】:

    标签: php alexa alexa-skills-kit alexa-skill


    【解决方案1】:

    返回的流必须是具有适当证书的 https 目标。你有一个 http 目的地。

    【讨论】:

    • 音频流也需要安全?
    • 是的。如需快速测试,请找到合适的在线文件并使用该 URL。
    • 我尝试将 mp3 放在服务器上并在本地播放。只需将 url 替换为 url 的直接链接,这也失败了。我的服务器有问题吗?它在带有letsencrypt ssl的服务器上。
    • 如果提供响应的是同一台服务器,则不是证书。如果不是尝试在您的代码中嵌入音频资源只是为了确保它不是证书。亚马逊没有提供有用的诊断信息。获取来自 AWS 服务器(我认为)而不是来自 Echo/AVS 设备。
    • 发送响应的是同一台服务器。我没有对请求进行任何验证,也没有提供真正的令牌。我所做的只是将顶部代码 sn-p 中的 url 替换为指向同一服务器上 pub 目录中文件的链接,并放置一个绝对链接。 server/file.mp3此时我迷路了哈哈
    猜你喜欢
    • 2012-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-23
    • 2021-06-02
    • 2021-10-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多