Skip to main content
Link a number you own in Twilio, and its calls reach the agent, app or SIP agent you choose. Fonoster sets up a SIP trunk in Twilio and in your workspace, and moves the number onto it. You can also place outbound calls from it.

Before you begin

You need:
  • A Twilio account with a voice-capable phone number in it. Note the number in E.164 format, such as +18095550123.
  • Your Twilio Account SID, which starts with AC, and one way to sign in to Twilio:
    • A Standard API key (recommended): its SID, which starts with SK, and its secret. Create one in the Twilio console under API keys & tokens.
    • Your Auth Token. It gives full access to your Twilio account, so prefer an API key.
    Twilio’s Restricted keys can’t link a number: no Restricted key permission covers the trunk’s IP access control list, credential list or phone numbers. Use a Standard key.
  • An agent, an app or a SIP agent to send calls to. See Build an Autopilot agent or Build a stream with the Voice SDK.
  • For the CLI: Node.js 22 or later.
1

Open the link drawer

Go to Numbers, click Link number, then Twilio number.
2

Choose the number and its route

Enter the Number and choose where to send its calls.
3

Enter your Twilio credentials

Enter your Twilio Account SID. Under Credentials, choose API key or Auth Token and fill it in.
4

Link it

Click Link number. The number shows in the list on Twilio Trunk.
Twilio now sends the number’s calls to Fonoster.If the number is already in your workspace, linking moves it to Twilio Trunk and the route you choose. A new number is named after itself; rename it under Numbers.On your own install, Twilio sends calls to your install’s public SIP address. Set it up first: Connect carriers and phones.
Call the number from any phone. Your agent, app or SIP agent answers.
Your Twilio number rings in Fonoster.
Without a terminal, the command never prompts: pass every value as a flag and the secret in an environment variable. This links a number to an application with a Standard API key:
To sign in with the Auth Token instead, set TWILIO_AUTH_TOKEN and pass --auth-token in place of --api-key-sid. A missing value stops the command with exit code 1 and names the flag or variable, such as Missing --account-sid. If the number is already in your workspace, the command stops unless you pass --yes, which replaces the number’s trunk and route.

What linking sets up

Linking changes both your Twilio account and your Fonoster workspace. It names everything after your workspace’s access key ID in lowercase, shown here as wo7d2kq9x4m1c8b3n6p0r5t2v9y4z7a1e3. In your Twilio account, the number +1 809 555 0123 moves onto an Elastic SIP trunk with an IP ACL for Fonoster's address and an origination URL sip:wo7d….pstn.fonoster.com. In your Fonoster workspace, a Twilio Trunk with inbound URI wo7d….pstn.fonoster.com carries the same number, which points at the Front desk agent. Incoming calls flow from Twilio to Fonoster; outbound calls flow back to wo7d….pstn.twilio.com. In your Twilio account, the number +1 809 555 0123 moves onto an Elastic SIP trunk with an IP ACL for Fonoster's address and an origination URL sip:wo7d….pstn.fonoster.com. In your Fonoster workspace, a Twilio Trunk with inbound URI wo7d….pstn.fonoster.com carries the same number, which points at the Front desk agent. Incoming calls flow from Twilio to Fonoster; outbound calls flow back to wo7d….pstn.twilio.com. In Twilio:
  • An Elastic SIP trunk named Trunk-<access key ID>, with the termination domain <access key ID>.pstn.twilio.com. Fonoster sends your outbound calls there.
  • An IP access control list named ACL-<access key ID> on that trunk, holding Fonoster’s signaling address. Twilio only accepts outbound calls from addresses on this list.
  • A SIP credential list named CL-<access key ID> on that trunk, holding the username and password Fonoster signs outbound calls with.
  • An origination URL sip:<access key ID>.pstn.fonoster.com on the trunk. Twilio sends calls to your number there.
  • Your number moves onto the trunk. Twilio then sends its calls over SIP, not to the number’s voice webhook.
In Fonoster:
  • A trunk named Twilio Trunk, with the inbound URI <access key ID>.pstn.fonoster.com and an outbound URI pointing at the Twilio termination domain.
  • A credential named Twilio <access key ID> on that trunk, matching the one in the Twilio credential list.
  • The number, on that trunk, pointing at the application you picked.
To link more Twilio numbers, link each one. Fonoster reuses the trunks on both sides and adds the number. Numbers linked before this release get the credential when you link them again.

Change where calls go

The linked number is a normal number in your workspace. To send its calls somewhere else, go to Numbers, open it, and pick a new destination under When this number is called, send it to. See Numbers and routing.

On your own install

On a self-hosted Fonoster, the server you’re signed in to sets the address Twilio sends calls to and the addresses Twilio accepts calls from, so the command needs no extra flags. Set your install’s public SIP address first: see Carriers and phones.

Troubleshooting

  • <number> isn't in Twilio account AC…1234. Check the number’s E.164 format and the Account SID.
  • Twilio didn't accept these credentials. Check the SID and the key or Auth Token.
  • This Twilio key can't …. Use a Standard API key or your Auth Token.
  • Twilio is unavailable; try again. Try again in a few minutes.
  • The number rings but nothing answers. Check that the number points at an application under Numbers.
  • Outbound calls fail. Twilio rejects calls from addresses outside the trunk’s access control list. On your own install, check your public SIP address in Carriers and phones.

Next steps

Numbers and routing

Send each number to the right agent, stream or SIP agent.

Make outbound calls

Call people from your Twilio number.

Connect a SIP trunk

Use another carrier.

Bring your Twilio or Pipecat app

Run a bot built for Twilio Media Streams on Fonoster.