Browse Source

修改Role为MASTER

locky 2 months ago
parent
commit
87f9c02709
1 changed files with 4 additions and 3 deletions
  1. 4 3
      Controller/AWS/KVSController.py

+ 4 - 3
Controller/AWS/KVSController.py

@@ -576,16 +576,17 @@ class KVSView(View):
                 ChannelARN=channel_arn,
                 SingleMasterChannelEndpointConfiguration={
                     'Protocols': ['HTTPS'],
-                    'Role': 'VIEWER'
+                    'Role': 'MASTER'
                 }
             )
             print(res)
             endpoint = res['ResourceEndpointList'][0]['ResourceEndpoint']
             url = '{}/v1/send-alexa-offer-to-master'.format(endpoint)
             # 构造请求 body
+            client_id = hashlib.md5((str(uuid.uuid1()) + str(int(time.time()))).encode('utf-8')).hexdigest()
             payload = {
                 'ChannelARN': channel_arn,
-                'SenderClientId': 'alexa-client-id',  # 任意唯一标识
+                'SenderClientId': client_id,
                 'MessagePayload': sdp_offer
             }
 
@@ -606,6 +607,6 @@ class KVSView(View):
             res = {
                 'sdp_answer': sdp_answer
             }
-            return response.json(0)
+            return response.json(0, res)
         except Exception as e:
             return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))