🚚(backend) rename TelephonyService to SIPManagement

Rename the telephony service to a more descriptive name,
SIPManagementService, which clearly states what the service is used
for.

It is no longer used only by the telephony feature; the roomkit
feature also relies on it now.
This commit is contained in:
lebaudantoine
2026-07-30 19:46:30 +02:00
parent 80f3af0690
commit ca80540f7e
7 changed files with 119 additions and 118 deletions
+8 -8
View File
@@ -28,7 +28,7 @@ from .room_management import (
RoomManagementException,
RoomNotFoundException,
)
from .telephony import TelephonyException, TelephonyService
from .sip_management import SIPException, SIPManagement
logger = getLogger(__name__)
@@ -107,7 +107,7 @@ class LiveKitEventsService:
)
self.webhook_receiver = api.WebhookReceiver(token_verifier)
self.lobby_service = LobbyService()
self.telephony_service = TelephonyService()
self.sip_management = SIPManagement()
self.recording_events = RecordingEventsService()
self._filter_regex = None
@@ -247,10 +247,10 @@ class LiveKitEventsService:
if settings.ROOM_TELEPHONY_ENABLED or settings.ROOMKIT_ENABLED:
try:
self.telephony_service.create_dispatch_rule(room)
except TelephonyException as e:
self.sip_management.create_dispatch_rule(room)
except SIPException as e:
raise ActionFailedError(
f"Failed to create telephony dispatch rule for room {room_id}"
f"Failed to create sip dispatch rule for room {room_id}"
) from e
def _handle_room_finished(self, data):
@@ -267,10 +267,10 @@ class LiveKitEventsService:
if settings.ROOM_TELEPHONY_ENABLED or settings.ROOMKIT_ENABLED:
try:
self.telephony_service.delete_dispatch_rule(room_id)
except TelephonyException as e:
self.sip_management.delete_dispatch_rule(room_id)
except SIPException as e:
raise ActionFailedError(
f"Failed to delete telephony dispatch rule for room {room_id}"
f"Failed to delete sip dispatch rule for room {room_id}"
) from e
try:
@@ -1,4 +1,4 @@
"""Telephony service for managing SIP dispatch rules for room access."""
"""SIP management service for managing SIP dispatch rules for room access."""
from logging import getLogger
@@ -17,16 +17,16 @@ from core import utils
logger = getLogger(__name__)
class TelephonyException(Exception):
"""Exception raised when telephony operations fail."""
class SIPException(Exception):
"""Exception raised when SIP operations fail."""
class DispatchRuleConflictError(TelephonyException):
class DispatchRuleConflictError(SIPException):
"""Raised when a dispatch rule already exists for the same routing criteria."""
class TelephonyService:
"""Service for managing participant access through the telephony system (SIP)."""
class SIPManagement:
"""Service for managing SIP access through the telephony or roomkit system (SIP)."""
def _rule_name(self, room_id):
"""Generate the rule name for a room based on its ID."""
@@ -36,7 +36,7 @@ class TelephonyService:
async def create_dispatch_rule(self, room):
"""Create a SIP inbound dispatch rule for direct room routing.
Configures telephony to route incoming SIP calls directly to the specified room
Configures livekit-sip to route incoming SIP calls directly to the specified room
using the room's ID and PIN code for authentication.
"""
@@ -60,7 +60,7 @@ class TelephonyService:
logger.exception(
"Unexpected error creating dispatch rule for room %s", room.id
)
raise TelephonyException("Could not create dispatch rule") from e
raise SIPException("Could not create dispatch rule") from e
finally:
await lkapi.aclose()
@@ -85,7 +85,7 @@ class TelephonyService:
)
except TwirpError as e:
logger.exception("Failed to list dispatch rules for room %s", room_id)
raise TelephonyException("Could not list dispatch rules") from e
raise SIPException("Could not list dispatch rules") from e
finally:
await lkapi.aclose()
@@ -146,7 +146,7 @@ class TelephonyService:
except TwirpError as e:
logger.exception("Failed to delete dispatch rules for room %s", room_id)
raise TelephonyException("Could not delete dispatch rules") from e
raise SIPException("Could not delete dispatch rules") from e
finally:
await lkapi.aclose()