from typing import Dict, Any, Optional from bot_definitions import bot_registry def determine_room_capabilities(body: Dict[str, Any]) -> Dict[str, bool]: bot_type = bot_registry.detect_bot_type(body) bot = bot_registry.get_bot(bot_type) capabilities = { "enable_dialin": False, "enable_dialout": False, } if not bot: return capabilities if bot.name == "call_transfer": call_transfer_config = body.get("call_transfer", {}) capabilities["enable_dialin"] = True if call_transfer_config.get("mode") == "dialout": capabilities["enable_dialout"] = True elif bot.name == "simple_dialin": capabilities["enable_dialin"] = True elif bot.name in ["simple_dialout", "voicemail_detection"]: capabilities["enable_dialout"] = True return capabilities async def process_dialin_request(data: Dict[str, Any]) -> Dict[str, Any]: body = { "dialin_settings": { "callId": data.get("callId"), "callDomain": data.get("callDomain"), "From": data.get("From"), "To": data.get("To"), } } return body def ensure_prompt_config(body: Dict[str, Any]) -> Dict[str, Any]: if "prompts" not in body: body["prompts"] = [] return body