daily
Daily room and token configuration utilities.
This module provides helper functions for creating and configuring Daily rooms and authentication tokens. It automatically creates temporary rooms for development or uses existing rooms specified via environment variables.
Functions:
configure(): Create a standard or SIP-enabled Daily room, returning a DailyRoomConfig object.
Environment variables:
DAILY_API_KEY - Daily API key for room/token creation (required)
DAILY_ROOM_URL (optional) - Existing room URL to use. If not provided, a temporary room will be created automatically.
Example:
import aiohttp
from pipecat.runner.daily import configure
async with aiohttp.ClientSession() as session:
# Standard room
room_url, token = await configure(session)
# SIP-enabled room for phone calls
config = await configure(session, sip_caller_phone="+15551234567")
# config contains: room_url, token, sip_endpoint
- class pipecat.runner.daily.DailyRoomConfig(*, room_url: str, token: str, sip_endpoint: str | None = None)[source]
Bases:
BaseModelConfiguration returned when creating a Daily room.
- Parameters:
room_url – The Daily room URL for joining the meeting.
token – Authentication token for the bot to join the room.
sip_endpoint – SIP endpoint URI for phone connections (None for standard rooms).
- room_url: str
- token: str
- sip_endpoint: str | None
- async pipecat.runner.daily.configure(aiohttp_session: ClientSession, *, api_key: str | None = None, room_exp_duration: float = 2.0, token_exp_duration: float = 2.0, sip_caller_phone: str | None = None, sip_enable_video: bool = False, sip_num_endpoints: int = 1, enable_dialout: bool = False, sip_codecs: dict[str, list[str]] | None = None, sip_provider: str | None = None, room_geo: str | None = None, room_properties: DailyRoomProperties | None = None, token_properties: DailyMeetingTokenProperties | None = None) DailyRoomConfig[source]
Configure Daily room URL and token with optional SIP capabilities.
This function will either: 1. Use an existing room URL from DAILY_ROOM_URL environment variable (standard mode only) 2. Create a new temporary room automatically if no URL is provided
- Parameters:
aiohttp_session – HTTP session for making API requests.
api_key – Daily API key.
room_exp_duration – Room expiration time in hours.
token_exp_duration – Token expiration time in hours.
sip_caller_phone – Phone number or identifier for SIP display name. When provided, enables SIP functionality and returns SipRoomConfig.
sip_enable_video – Whether video is enabled for SIP.
sip_num_endpoints – Number of allowed SIP endpoints.
enable_dialout – Whether to enable outbound dialing (PSTN or SIP) on the room. Requires dial-out entitlement on your Daily account.
sip_codecs – Codecs to support for audio and video. If None, uses Daily defaults. Example: {“audio”: [“OPUS”], “video”: [“H264”]}
sip_provider – SIP provider name (e.g., “daily”). Only used when sip_caller_phone is provided and room_properties is not.
room_geo – Daily room geographic region (e.g., “us-east-1”). Only used when room_properties is not provided.
room_properties – Optional DailyRoomProperties to use instead of building from individual parameters. When provided, this overrides room_exp_duration and SIP-related parameters. If not provided, properties are built from the individual parameters as before.
token_properties – Optional DailyMeetingTokenProperties to customize the meeting token. When provided, these properties are passed to the token creation API. Note that room_name, exp, and is_owner will be set automatically.
- Returns:
Object with room_url, token, and optional sip_endpoint. Supports tuple unpacking for backward compatibility: room_url, token = await configure(session)
- Return type:
- Raises:
Exception – If DAILY_API_KEY is not provided in environment variables.
Examples:
# Standard room room_url, token = await configure(session) # SIP-enabled room sip_config = await configure(session, sip_caller_phone="+15551234567") print(f"SIP endpoint: {sip_config.sip_endpoint}") # Custom room properties with recording enabled custom_props = DailyRoomProperties( enable_recording="cloud", max_participants=2, ) config = await configure(session, room_properties=custom_props)