2026-04-29 11:39:57 +05:30
|
|
|
"""Telnyx telephony configuration schemas."""
|
|
|
|
|
|
2026-05-02 15:53:58 +05:30
|
|
|
from typing import List, Literal, Optional
|
2026-04-29 11:39:57 +05:30
|
|
|
|
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TelnyxConfigurationRequest(BaseModel):
|
|
|
|
|
"""Request schema for Telnyx configuration."""
|
|
|
|
|
|
|
|
|
|
provider: Literal["telnyx"] = Field(default="telnyx")
|
|
|
|
|
api_key: str = Field(..., description="Telnyx API Key")
|
2026-05-02 15:53:58 +05:30
|
|
|
connection_id: Optional[str] = Field(
|
|
|
|
|
default=None,
|
|
|
|
|
description=(
|
|
|
|
|
"Telnyx Call Control Application ID (connection_id). If omitted, "
|
|
|
|
|
"a Call Control Application is auto-created on save and its id is "
|
|
|
|
|
"stored on the configuration."
|
|
|
|
|
),
|
2026-04-29 11:39:57 +05:30
|
|
|
)
|
2026-05-09 18:03:42 +05:30
|
|
|
webhook_public_key: Optional[str] = Field(
|
|
|
|
|
default=None,
|
|
|
|
|
description=(
|
|
|
|
|
"Webhook public key from Mission Control Portal → Keys & "
|
|
|
|
|
"Credentials → Public Key. Used to verify Telnyx webhook "
|
|
|
|
|
"signatures."
|
|
|
|
|
),
|
|
|
|
|
)
|
2026-04-29 11:39:57 +05:30
|
|
|
# Phone numbers are managed via the dedicated phone-numbers endpoints; the
|
|
|
|
|
# legacy /telephony-config POST shim still accepts them inline.
|
|
|
|
|
from_numbers: List[str] = Field(
|
|
|
|
|
default_factory=list, description="List of Telnyx phone numbers"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TelnyxConfigurationResponse(BaseModel):
|
|
|
|
|
"""Response schema for Telnyx configuration with masked sensitive fields."""
|
|
|
|
|
|
|
|
|
|
provider: Literal["telnyx"] = Field(default="telnyx")
|
|
|
|
|
api_key: str # Masked
|
2026-05-02 15:53:58 +05:30
|
|
|
connection_id: Optional[str] = None
|
2026-05-09 18:03:42 +05:30
|
|
|
webhook_public_key: Optional[str] = None
|
2026-04-29 11:39:57 +05:30
|
|
|
from_numbers: List[str]
|