Skip to main content

Connect a Twilio SIP trunk from the dashboard

You can connect a Twilio number to MediaSFU from the dashboard, with no code. The setup has two sides: what your Twilio trunk trusts, and the phone line you add in MediaSFU. Once both are in place, calls flow both ways and you can let a person or an AI agent answer.

▶ Watch this: Connect a Twilio SIP trunk, 2:26.

At a glance:

  1. In Twilio, add both MediaSFU SIP addresses to the trunk's IP Access Control List and set the Origination SIP URI to your number at sip01.mediasfu.com.
  2. In the dashboard, open Phone & SIP Setup, choose Add a number, enter the number in E.164 format, choose Twilio and a call direction.
  3. On Peer Config, paste the host from the trunk's Termination SIP URI, use port 5060 for UDP or TCP (5061 for TLS), and leave Register with Provider off.
  4. Optionally add call features or an AI agent, then choose Create SIP Config.

Before you start​

  • A Twilio account with an Elastic SIP Trunk and a phone number on it.
  • A MediaSFU account that can open Phone & SIP Setup in the dashboard.

Step 1: Let Twilio trust MediaSFU​

In the Twilio Console, open your Elastic SIP Trunk:

  1. IP Access Control List (Termination): add both MediaSFU SIP signalling addresses as /32 entries. MediaSFU signals from two regions, Canada and the United Kingdom; the current addresses are listed on the Telephony guide. Keep both, so calls still pass if one region takes over.
  2. Origination SIP URI (incoming calls): set it to your number at sip01.mediasfu.com, for example sip:+15551234567@sip01.mediasfu.com.
  3. Credential List (optional): if your trunk also uses a Credential List, note its username and password for Step 3.
  4. Associate your Twilio number with this trunk.

Step 2: Add the number in MediaSFU (Basics)​

  1. In the dashboard, open Phone & SIP Setup and choose Add a number. The Guided setup opens.
  2. Contact Number: enter your Twilio number in E.164 format: a plus sign, the country code and the number, with no spaces (for example +14155551234).
  3. SIP Provider: choose Twilio.
  4. Call direction: Both receives and places calls. Inbound Only or Outbound Only keeps the line to one direction.

Step 3: Trunk host, port and transport (Peer Config)​

  1. SIP Server Host: paste the host from your trunk's Termination SIP URI, without the sip: prefix and without a port, for example your-trunk.pstn.twilio.com. A Voice SIP Domain such as your-domain.sip.twilio.com also works.
  2. Port and Transport: port 5060 for UDP or TCP. Choosing TLS (Secure) switches the port to 5061.
  3. Register with Provider: leave it off for Twilio. Twilio checks the IP Access Control List or per-call credentials, not registration, and the dashboard shows a note saying so if you turn it on.
  4. SIP Username and SIP Password: if your trunk has a Credential List, enter its username and password here; MediaSFU answers Twilio's challenge with them on outgoing calls. If the trunk relies on the IP Access Control List alone, leave both empty.

Step 4: Finish and create the line​

  1. Features (optional): Auto Record records every call, and SIP Only keeps web participants out of the call. You can also add a Webhook URL to receive call events.
  2. AI Agent (optional): an AI agent can answer the line now or later. See Answer a phone line with an AI agent.
  3. Confirm: check the summary and choose Create SIP Config.

The line is ready, with registration off. With your Twilio number associated with the trunk, calls flow both ways.

If calls do not connect​

  • Incoming calls do not arrive: check that the Origination SIP URI uses your exact number in E.164 format at sip01.mediasfu.com, and that the number is associated with the trunk.
  • Outgoing calls are refused: check that both MediaSFU addresses are on the trunk's IP Access Control List. If the trunk also has a Credential List, check the SIP Username and SIP Password on the line.
  • The host is flagged: the dashboard checks that the host looks like a Twilio trunk or SIP domain. Paste the host only, with no sip: prefix and no port.