Skip to main content

How SIP trunking works

SIP trunking lets you connect your existing telephony infrastructure directly to Cartesia Agents. Inbound calls. Your carrier sends traffic to Cartesia’s SIP endpoint. Cartesia routes calls to the agent assigned to the dialed number. Outbound calls. Cartesia places calls through your carrier’s SIP endpoint. Your carrier determines the caller ID shown to the recipient. Authentication. Restrict inbound traffic with digest authentication, a source-IP allowlist, or both. Signaling and media. Call setup uses TCP or TLS. TLS encrypts signaling. The media_encryption setting controls SRTP negotiation for call audio: disabled, allowed, or required.

Configure your PSTN provider

Complete these steps with your carrier before registering the trunk with Cartesia:
  1. For inbound calls, set the trunk’s origination URI to Cartesia’s SIP endpoint. Choose the transport your carrier supports:
    • TCP: sip:sip.cartesia.ai;transport=tcp
    • TLS: sip:sip.cartesia.ai;transport=tls
  2. Restrict inbound traffic. Configure digest credentials or collect your carrier’s SIP signaling IP ranges for allowed_addresses.
  3. For outbound calls, configure your carrier to accept calls from Cartesia. Set up credentials or another authentication method supported by your carrier. If your carrier or firewall restricts SIP traffic by IP address, see the static IP guidance below.
  4. If you use TLS with media_encryption: required, enable secure trunking and SRTP with your carrier. Configuring Cartesia alone does not enable encryption on the carrier side.

Cartesia SIP static IP ranges

If your carrier or firewall requires restricting SIP signaling by source or destination IP address, you can allowlist our static IP ranges. For help with static IP allowlisting, contact support@cartesia.ai.
Do not leave credentials, allowed_addresses, and allowed_numbers all empty on an inbound trunk. Configure at least one access-control method before accepting calls.
Twilio Elastic SIP Trunking does not support digest authentication for inbound origination. Use allowed_addresses with Twilio’s current signaling IP ranges. For outbound calls with TLS and required media encryption, enable Secure Trunking and create a matching credential list in Twilio.
Once the carrier-side configuration is ready, register the trunk with Cartesia. The example uses digest authentication in both directions. Replace the hostname and credentials with the values configured at your carrier. See Create Provider for every field.
The response returns the provider id and sanitized trunk configuration. Passwords are never returned. Cartesia exposes each configured username as auth_username.

Import a number

Import a carrier number using the provider id from the previous step. See Import Phone Number for all fields.
Expected response:

Assign to an agent

Assign the imported number to an agent so inbound calls are routed to it.
You can alternatively pass agent_id on import to assign an agent in the same request.
Expected response:
To unassign, set agent_id to null.

Transfer calls

Cartesia supports cold transfers to E.164 phone numbers over SIP REFER. Add the built-in transfer_call tool to your agent and provide the destination as target_phone_number. Your carrier must accept REFER requests and route tel: targets. For Twilio Elastic SIP Trunking, set the trunk’s transfer mode to enable-all. If the carrier rejects the transfer, Cartesia keeps the original call connected.

Place outbound calls

Use the imported phone number as from_number_id to route outbound calls through the configured trunk. The carrier determines the caller ID shown to the recipient. See Create Outbound Call for all fields.
Expected response:
Successful entries include agent_call_id. Failed entries include an error and may omit the call ID. Use Get Call to monitor successful calls.