TwilioAdapter (providers/twilio_adapter.py)

Patter · libraries/python/getpatter/providers/twilio_adapter.py · python · MIT
voice, Voice / Speech

Async Twilio adapter for provisioning numbers and making calls.

# Source: https://github.com/PatterAI/Patter | License: MIT | Copyright 2026 Patter Contributors
# Provided via justclaw.it.com; keep this notice with the code.
"""Twilio :class:`TelephonyProvider` — number provisioning and call control.

Async wrapper over the synchronous Twilio REST client. Sync calls are
dispatched to a thread executor so the event loop is never blocked.
"""

import asyncio
import logging
import re
from functools import partial
from twilio.rest import Client as TwilioClient
from twilio.twiml.voice_response import VoiceResponse, Connect
from getpatter.providers.base import TelephonyProvider

logger = logging.getLogger("getpatter.providers.twilio_adapter")


_PASCAL_TO_SNAKE_RE = re.compile(r"(?<!^)(?=[A-Z])")


def _to_snake_case(name: str) -> str:
    """Translate a Pas

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key