fix: compute correct LiveKit room name hash for Element Call
Element Call uses SHA256(room_id + "|m.call#ROOM") encoded as unpadded base64 for LiveKit room names (via lk-jwt-service). The bot was using the raw Matrix room ID, causing agent and user to join different rooms. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
bot.py
13
bot.py
@@ -2,6 +2,7 @@ import os
|
||||
import json
|
||||
import asyncio
|
||||
import base64
|
||||
import hashlib
|
||||
import io
|
||||
import logging
|
||||
import re
|
||||
@@ -389,13 +390,11 @@ class Bot:
|
||||
"livekit_alias": room_id,
|
||||
}])
|
||||
|
||||
# Extract LiveKit room name from foci and dispatch agent
|
||||
lk_room_name = room_id # fallback
|
||||
for f in foci:
|
||||
if f.get("type") == "livekit" and f.get("livekit_alias"):
|
||||
lk_room_name = f["livekit_alias"]
|
||||
break
|
||||
logger.info("LiveKit room name: %s (from foci_preferred)", lk_room_name)
|
||||
# Compute LiveKit room name using same hash as lk-jwt-service
|
||||
# SHA256(room_id + "|" + "m.call#ROOM") encoded as unpadded base64
|
||||
lk_room_hash = hashlib.sha256((room_id + "|m.call#ROOM").encode()).digest()
|
||||
lk_room_name = base64.b64encode(lk_room_hash).decode().rstrip("=")
|
||||
logger.info("LiveKit room name: %s (hashed from %s)", lk_room_name, room_id)
|
||||
|
||||
if room_id not in self.dispatched_rooms:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user