pinecallDocs
Integrations / Twilio

Twilio

Connect a Twilio account: its numbers, buying one, and calling out.

Connect your Twilio account once, and Pinecall lists its numbers, points the ones you pick at an agent, and can place calls through it. Twilio is the one carrier Pinecall drives through its API, so you never configure a trunk by hand.

What you can do with it#

Connect your account#

Make an API key in Twilio#

In Twilio's console, under Account ▸ API keys, create a key. Keep its SID (SK…) and its secret. You can revoke it there at any time.

Add it in Pinecall#

On production's console, open Numbers ▸ Add a number ▸ Twilio and fill in the Account SID (AC…), the API key SID and the secret. Pinecall tries them against Twilio before it keeps them, and stores the secret encrypted. It is never shown again.

Pick a number and an agent#

The form lists every number on the account, read from Twilio just now. Pick one and the agent that answers it, then Review: the console shows each step it will take, and nothing changes until you press Connect number.

The same from a terminal, the secret typed on stdin:

Terminal
$ pinecall carriers add twilio --account-sid AC0123… --user SK4567… --label Clínica
Twilio secret (the API key's, or the auth token):
kept: AC0123… · twilio · Clínica
  route one of its numbers: `pinecall numbers import <+34…> --agent <slug>`
$ pinecall numbers available --prod
$ pinecall numbers import +34910000000 --agent clinica-norte --prod --dry-run

--user also takes the account SID again, with the auth token as the secret, but an API key is the one you can revoke on its own. Running carriers add again for the same account replaces its secret: that is how you rotate it.

An org may connect several Twilio accounts. Connect another from Numbers ▸ Accounts ▸ Connect another Twilio account, from Connect another beside the account picker of Add a number, or with pinecall carriers add twilio again. With more than one, pinecall numbers import names the account the number lives in with --account <AC…> (the MCP's numbers import, with account); the console's picker does it for you.

What Pinecall changes in your account#

When you connect a number, Pinecall does what you would do in Twilio's console, and nothing more:

  • it finds the account's Elastic SIP Trunk that sends calls to Pinecall, or makes one when there is none;
  • it attaches the number to that trunk. The number's own voice URL is then ignored by Twilio.

Every step is looked up before it is written, so running it twice changes nothing twice. Pinecall never deletes and remakes a trunk: carriers' fraud checks read that pattern as an account taken over.

Remove on the Numbers screen, or pinecall numbers drop, stops the number reaching the agent. The number stays on your account.

A number already attached to another trunk of the same account is refused, and the refusal names that trunk. Run pinecall numbers import … --dry-run before you connect a number that may be in use elsewhere.

Twilio marks every call with the account it came from, and Pinecall checks it: a call to your number that did not come from your account is refused.

Buying a number#

Where Pinecall sells numbers, Numbers ▸ Add a number offers Buy a number here. Give a country (two letters) and, if you want, an area code, then Find a number. The console names the number it found; nothing is bought until you confirm.

A bought number lives on Pinecall's own Twilio account, whether or not your org connected one of its own. It counts against your org's numbers limit in that world — the form shows how many are bought, and pinecall limits too (Limits & provider keys) — and it cannot call out, because it dials through no account of yours. The console's Numbers screen is production's, so it buys into production.

From a terminal or an assistant, pinecall numbers buy --country <XX> [--area <digits>] --agent <slug> (and the MCP's numbers buy) does the same, in the world the command acts in. --dry-run names the number and buys nothing.

Calling out#

An agent can call people from a number on your Twilio account, once outbound calls are on:

Open Calling out#

On production's console, Numbers ▸ Calling out ▸ Turn on outbound calls. The console shows what will happen on your Twilio account and on Pinecall before anything is written.

Confirm#

Pinecall sets a termination address on the trunk, a credential list on it, and one credential for your org. Pinecall makes that credential's password and keeps it, encrypted: Twilio never shows it again.

Make a test call#

The same tab has Make a test call: an agent, one of its numbers, and the number to call.

Which countries your agents may reach is your Twilio account's own setting (its geographic permissions). Every call also passes Pinecall's dialling rules: Calling out.

If Pinecall no longer holds the password of a credential it made, turning outbound calls on is refused with a sentence naming that credential. Delete it in Twilio's console, then turn outbound calls on again.

Next steps#