revert: Restore voice.py and bot.py to last known working state (9aef846)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-02-21 20:47:51 +02:00
parent 463286a61e
commit 4a93827de3
2 changed files with 32 additions and 49 deletions

16
bot.py
View File

@@ -448,13 +448,12 @@ class Bot:
model = self.room_models.get(room_id, DEFAULT_MODEL)
caller_device_id = content.get("device_id", "")
# Generate bot's E2EE key and publish it so Element Call
# can decrypt our audio. This also triggers Element Call
# to share its key with us.
# Publish a placeholder key first to trigger Element Call
# to share its key with us. We'll republish the real shared
# key once we receive the caller's key.
import secrets
bot_key = secrets.token_bytes(16)
# Publish bot's key early so Element Call can decrypt our audio
await self._publish_encryption_key(room_id, bot_key)
placeholder_key = secrets.token_bytes(16)
await self._publish_encryption_key(room_id, placeholder_key)
vs = VoiceSession(
nio_client=self.client,
@@ -462,9 +461,8 @@ class Bot:
device_id=BOT_DEVICE_ID,
lk_url=LK_URL,
model=model,
publish_key_cb=lambda key, rid=room_id: asyncio.ensure_future(
self._publish_encryption_key(rid, key)),
bot_key=bot_key,
publish_key_cb=lambda key: asyncio.ensure_future(
self._publish_encryption_key(room_id, key)),
)
# Check timeline for caller's key