From 578b6bb56f21b9d1066ec52f124c02f38ebd1093 Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Fri, 20 Feb 2026 07:16:35 +0000 Subject: [PATCH] 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 --- bot.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bot.py b/bot.py index 8bc307b..c100163 100644 --- a/bot.py +++ b/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: