dial_sdk.self_hosted¶
Self-Hosted protocol — the WebSocket contract your server speaks when Dial drives a call through your own LLM.
These pydantic models are the executable form of
https://docs.getdial.ai/api-reference/self-hosted-protocol, plus
verify_dial_signature for the X-Dial-Signature header. Configuration of
Self-Hosted mode happens in the dashboard / REST API — this module is purely the
protocol types + signature verification for building a conformant server.
Attributes¶
Classes¶
Functions¶
|
Parse + validate a frame received from Dial. Raises |
|
Validate + serialize an outbound frame to a JSON string (omitting unset |
|
Verify a Dial |
Module Contents¶
- class dial_sdk.self_hosted.CallConnected¶
Bases:
pydantic.BaseModel- call_id: str¶
- direction: Literal['inbound', 'outbound']¶
- from_: str¶
- instruction: str | None = None¶
- language: str | None = None¶
- model_config¶
- to: str¶
- type: Literal['call_connected']¶
- class dial_sdk.self_hosted.Interrupt¶
Bases:
pydantic.BaseModel- content: str¶
- content_complete: bool¶
- end_call: bool | None = None¶
- type: Literal['interrupt']¶
- class dial_sdk.self_hosted.PingPong¶
Bases:
pydantic.BaseModel- timestamp: int¶
- type: Literal['ping_pong']¶
- class dial_sdk.self_hosted.ReminderRequired¶
Bases:
pydantic.BaseModel- response_id: int¶
- transcript: list[TranscriptItem]¶
- type: Literal['reminder_required']¶
- class dial_sdk.self_hosted.Response¶
Bases:
pydantic.BaseModel- content: str¶
- content_complete: bool¶
- end_call: bool | None = None¶
- response_id: int¶
- type: Literal['response']¶
- class dial_sdk.self_hosted.ResponseRequired¶
Bases:
pydantic.BaseModel- response_id: int¶
- transcript: list[TranscriptItem]¶
- type: Literal['response_required']¶
- class dial_sdk.self_hosted.TranscriptUpdate¶
Bases:
pydantic.BaseModel- transcript: list[TranscriptItem]¶
- type: Literal['transcript_update']¶
- dial_sdk.self_hosted.parse_dial_message(raw: str | bytes | dict) DialServerMessage¶
Parse + validate a frame received from Dial. Raises
ValidationError.
- dial_sdk.self_hosted.serialize_server_message(message: ServerDialMessage) str¶
Validate + serialize an outbound frame to a JSON string (omitting unset
end_call).
- dial_sdk.self_hosted.verify_dial_signature(secret: str, header: str, data: str, *, now: int | None = None, tolerance_seconds: int = 300) bool¶
Verify a Dial
X-Dial-Signature: t=<unix_seconds>,v1=<hex>header.The signature is
HMAC-SHA256(secret, "<t>.<data>"), wheredatais the value the signature covers — thecall_idfor the self-hosted WebSocket protocol, or the raw request body for a webhook delivery. ReturnsFalse(never raises) on a malformed header, a stale/future timestamp, or a mismatch. Matches Dial’s server-side signer byte-for-byte.
- dial_sdk.self_hosted.DialServerMessage¶
- dial_sdk.self_hosted.Role¶
- dial_sdk.self_hosted.ServerDialMessage¶