fix: send proper hello response with version and audio_params
ESP32 expects full xiaozhi hello format including version and audio_params, otherwise it disconnects and retries. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
fc3c99d09c
commit
9365d8c4c9
11
relay.py
11
relay.py
|
|
@ -184,11 +184,18 @@ class Relay:
|
||||||
msg_type = msg.get("type")
|
msg_type = msg.get("type")
|
||||||
|
|
||||||
if msg_type == "hello":
|
if msg_type == "hello":
|
||||||
# Respond with hello ack
|
# Respond with proper hello — must match xiaozhi protocol
|
||||||
resp = {
|
resp = {
|
||||||
"type": "hello",
|
"type": "hello",
|
||||||
"session_id": "relay-session",
|
"version": 1,
|
||||||
"transport": "websocket",
|
"transport": "websocket",
|
||||||
|
"session_id": "relay-session",
|
||||||
|
"audio_params": {
|
||||||
|
"format": "opus",
|
||||||
|
"sample_rate": ESP_SAMPLE_RATE,
|
||||||
|
"channels": 1,
|
||||||
|
"frame_duration": ESP_FRAME_MS,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
await self.ws.send(json.dumps(resp))
|
await self.ws.send(json.dumps(resp))
|
||||||
log.info(f"ESP32 hello: {msg.get('audio_params')}")
|
log.info(f"ESP32 hello: {msg.get('audio_params')}")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue