🐛(backend) ensure SIP dispatch rule instead of creating it

The roomkit can now create a SIP dispatch rule before the LiveKit
webhook that used to trigger this creation is fired. In practice,
when the roomkit connects to the room, it also triggers the
webhook, leading to a duplicated dispatch rule.

Switch from "create dispatch rule" to "ensure dispatch rule exists"
semantics, so subsequent calls are idempotent and no duplicate rule
is created.
This commit is contained in:
lebaudantoine
2026-07-30 21:01:07 +02:00
parent ca80540f7e
commit 5790bb1e47
2 changed files with 54 additions and 15 deletions
+1 -1
View File
@@ -247,7 +247,7 @@ class LiveKitEventsService:
if settings.ROOM_TELEPHONY_ENABLED or settings.ROOMKIT_ENABLED:
try:
self.sip_management.create_dispatch_rule(room)
self.sip_management.ensure_dispatch_rule(room)
except SIPException as e:
raise ActionFailedError(
f"Failed to create sip dispatch rule for room {room_id}"