2017-10-05 109 views
0

我有多個設備將音頻流式傳輸到我的服務器。將額外的自定義設備狀態傳遞給Alexa自定義技能

我的服務器發送音頻到我的自定義技能

我如何通過額外的狀態在房間裏的設備是到適配器e.g「房間名」?

我多請求包括:

{ 
    'context': [ 
     { 
      'header': { 
       'namespace': 'AudioPlayer', 
       'name': 'PlaybackState' 
      }, 
      'payload': { 
       'token': '', 
       'offsetInMilliseconds': 0, 
       'playerActivity': 'IDLE' 
      } 
     }, 
     { 
      'header': { 
       'namespace': 'Speaker', 
       'name': 'VolumeState' 
      }, 
      'payload': { 
       'volume': 100, 
       'muted': False, 
      } 
     }, 
     { 
      'header': { 
       'namespace': 'SpeechSynthesizer', 
       'name': 'SpeechState' 
      }, 
      'payload': { 
       'token': '', 
       'offsetInMilliseconds': 0, 
       'playerActivity': 'FINISHED' 
      } 
     } 
    ], 
    'event': { 
     'header': { 
      'namespace': 'SpeechRecognizer', 
      'name': 'Recognize', 
      'messageId': 'my-messageId', 
      'dialogRequestId': 'my-dialogRequestId', 
     }, 
     'payload': { 
      'profile': 'CLOSE_TALK', 
      'format': 'AUDIO_L16_RATE_16000_CHANNELS_1' 
     } 
    } 
} 

我試圖通過任意的擴展頭的情況下例如,

[ 
    'header': { 
     'namespace': 'MyCustomSkill', 
     'name': 'RoomState' 
    }, 
    'payload': { 
     'name': 'kitchen', 
     'temperature': '40' 
    } 
] 

但適配器沒有獲得這些額外的頭。請求如下所示:

{ 
    "request": { 
     "locale": "en-GB", 
     "type": "IntentRequest", 
     "timestamp": "2017-10-05T22:33:35Z", 
     "requestId": "amzn1.echo-api.request.a415ac1b-7b42-4520-830d-a48912956a45", 
     "intent": { 
     "slots": { 
      "ROOM": { 
       "value": "kitchen", 
       "resolutions": { 
        "resolutionsPerAuthority": [ 
        { 
         "authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.c9fd57b8-b243-42ed-a6a9-5745fccb6746.ROOM", 
         "values": [ 
          { 
           "value": { 
           "id": "09228dac155633b13780552bc01dc2e0", 
           "name": "kitchen" 
           } 
          } 
         ], 
         "status": { 
          "code": "ER_SUCCESS_MATCH" 
         } 
        } 
        ] 
       }, 
       "name": "ROOM", 
       "confirmationStatus": "NONE" 
      } 
     }, 
     "name": "ChatIntent", 
     "confirmationStatus": "NONE" 
     } 
    }, 
    "context": { 
     "AudioPlayer": { 
     "playerActivity": "IDLE" 
     }, 
     "System": { 
     "user": { 
      "userId": "my-user-id" 
     }, 
     "apiEndpoint": "https://api.eu.amazonalexa.com", 
     "device": { 
      "deviceId": "my-device-id", 
      "supportedInterfaces": { 
       "AudioPlayer": {} 
      } 
     }, 
     "application": { 
      "applicationId": "my-application-id" 
     } 
     } 
    }, 
    "version": "1.0", 
    "session": { 
     "user": { 
     "userId": "my-user-id" 
     }, 
     "sessionId": "amzn1.echo-api.session.8c3e0d80-69e3-49ad-a981-d1073e0100b2", 
     "new": true, 
     "application": { 
     "applicationId": my-application-id" 
     } 
    } 
} 

這是可以通過上下文來實現嗎?

回答

相關問題