Phone Numbers
Search for available phone numbers, purchase them, and manage the numbers in your
SignalWire project. This resource extends the standard CRUD pattern with a search()
method for discovering available numbers, uses PUT for updates, and provides typed
helpers for binding inbound calls to a handler (SWML webhook, cXML webhook, AI agent,
call flow, RELAY application/topic).
Access via client.phone_numbers on a RestClient instance.
Methods
Standard CRUD
List phone numbers owned by the project.
Purchase a phone number.
Retrieve details for a specific phone number.
Update configuration for a phone number.
Release a phone number from the project.
Search for available phone numbers to purchase.
Typed Binding Helpers
Each helper is a one-line wrapper over update that sets call_handler to
the right value and populates the handler-specific companion field for you. Pass extra
keyword arguments through to update for fields the helper doesn’t name explicitly.
Setting a binding auto-materializes the matching Fabric resource on the server.
Route inbound calls to an SWML webhook URL.
Route inbound calls to a cXML (LAML) webhook.
Route inbound calls to an existing cXML application by ID.
Route inbound calls to an AI Agent Fabric resource by ID.
Route inbound calls to a Call Flow by ID.
Route inbound calls to a named RELAY application.
Route inbound calls to a RELAY topic.
PhoneCallHandler enum
For callers passing call_handler directly to update, the
PhoneCallHandler enum provides typed values. Each member is a str subclass, so
passing the enum member serializes to the wire value without .value indirection.
LAML_WEBHOOKS (wire value laml_webhooks) produces a cXML handler, not a
generic webhook. For SWML, use RELAY_SCRIPT — or, more conveniently, the
set_swml_webhook helper.