Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

How to add Programmability to your existing SIP network


Learn to receive SIP inbound phone calls from your infrastructure to Twilio by configuring a SIP Domain and registered endpoint. To do this, you will create a SIP Domain and associate a credential list to enable logic when a call is received.

You can use this guide for self-service automation, inbound contact centers, and PSTN connectivity.

See Related reference documentation to learn more about the SIP and API elements used in this guide.

(information)

Info

If you are looking to explore SIP functionality, we recommend following the SIP Quickstart to get you up and running in a few clicks!

Are you interested in learning how to make calls using SIP with Twilio programmability? This guide will show you how to use Programmable Voice(link takes you to an external page) to receive SIP inbound phone calls from your SIP infrastructure to Twilio

Twilio Programmable SIP Domain makes it possible to create Enterprise Grade features, contact center feasible functionality in minutes. It's possible to add to programmable logic to your calls to make your business applications more intelligent. Twilio also offers global reach with its rich and reliable PSTN network.


Steps to make an inbound SIP calls

steps-to-make-an-inbound-sip-calls page anchor
  1. Configure SIP Domain
  2. Configure your SIP Endpoint
  3. Make an inbound SIP call from Twilio Registered Endpoint

Let's get started!


To receive SIP traffic from your network, configure a SIP Domain in Twilio. In this example, we use a Twilio Registered Endpoint to send SIP traffic to Twilio, so the following procedure enables SIP Registration and associates a credential list.

(information)

Info

The SIP registration steps in the following SIP Domain procedure are only required if you're using a Twilio Registered Endpoint. If you're not, skip them.

  1. Configure a Credential List.

    Twilio ConsoleLegacy Console
    1. Open Twilio Console(link takes you to an external page) and go to Voice > SIP Domains > Credential Lists(link takes you to an external page).
    2. Select Create Credential List.
    3. Enter a Credential list friendly name of Endpoint.
    4. In the Add credentials section, enter a Username (this can be an E.164 number, extension number, or name) of UserA and a Password of yourpassword.
    5. Select Save.

    These credentials are used by your SIP Endpoints to authenticate with Twilio.

  2. Configure a SIP Domain.

    Twilio ConsoleLegacy Console
    1. Open Twilio Console(link takes you to an external page) and go to Voice > SIP Domains(link takes you to an external page).
    2. Select Create SIP Domain.
    3. In the Properties section, enter a SIP domain friendly name of T1 and a SIP URI of Trunk1. SIP URIs must be unique across Twilio — if Trunk1 is taken, choose another name.
    4. In the Voice authentication section, select the Endpoint credential list from Credential lists.
    5. Select Create.
    6. On the SIP Domain details page, find the SIP registration section and select Edit SIP registration.
    7. Set Enable SIP registration to Enabled.
    8. Select the Endpoint credential list from Credential lists.
    9. Select Save.

A SIP Endpoint can be a desk phone or a softphone. In this guide we use a softphone and configure it to register with the SIP Registrar.

(information)

Info

If you're not using a Twilio Registered Endpoint, skip this section.

  1. Download and install SIP Endpoint. Zoiper(link takes you to an external page) is used for example

  2. Provide login name - UserA@Trunk1.sip.us1.twilio.com (do add us1 region parameter to your sip domain) and password

  3. Click "Next/continue" to confirm the Domain.

  4. Optional settings can be skipped

  5. Done! You see in Zoiper that it is "Registered" and has "Tick" next to your login name.

  6. You can also verify the successfully registered endpoints in the Registered SIP Endpoints section of your SIP Domain page in Twilio Console.


Make an inbound SIP call from Twilio Registered Endpoint

make-an-inbound-sip-call-from-twilio-registered-endpoint page anchor

It is possible to add programmable logic to your call when the call is received by Twilio. For example, we will have the code that greets the caller and make a call to your cellphone.

With Twilio you can make calls only from a verified phone number or from Twilio number. If you plan to use a number other than Twilio phone number, then go to Verified callerID(link takes you to an external page) page and click + to ensure your number is valid and verified.

We will now write the TwiML for our application. Because this is a static application, we will use a TwiML Bin. Visit the TwiML Bin(link takes you to an external page) page and click the + icon to add a new bin.

Set the Friendly Name as Greet and call and copy and paste the TwiML below:

1
<?xml version="1.0" encoding="UTF-8"?>
2
<Response>
3
<Say>Thank you for doing the tutorial. Will now call your cellphone</Say>
4
<Dial callerId="+1233451789">+15557650987</Dial>
5
</Response>
6
(warning)

Warning

Make sure to add a verified number for callerId to dial.

Create the TwiML Bin and copy the URL, see below

TwiML Bin properties showing SID and URL with copy button.

With our TwiML Bin created, now we need to wire it up to our SIP Domain.

  1. Open the SIP Domains page in Twilio Console(link takes you to an external page) or the legacy Console(link takes you to an external page) and select the domain you created.
  2. Scroll down to "Voice Configuration" paste the copied URL from above to "Request URL" and click "Save"

Now go to zoiper SIP client and dial your cellphone. You will hear the greeting in zoiper and it will ring your cellphone. Congratulations, you have made your inbound SIP call.


Use cases for SIP inbound calls with Twilio Programmable Voice

use-cases-for-sip-inbound-calls-with-twilio-programmable-voice page anchor

This guide teaches the basics required for the following use cases:

Create self-service automation with Twilio Programmable Voice

create-self-service-automation-with-twilio-programmable-voice page anchor

Together with the <Gather> guide, you can use this guide to automate inbound SIP calls that gather user input using the keypad for self-service automation. For example, you can create IVR menus that allow customers to route their own calls or retrieve account information.

To learn more advanced features that you can use with self-service automation, see Voice self-service automation.

Create an inbound contact center with Twilio Programmable Voice

create-an-inbound-contact-center-with-twilio-programmable-voice page anchor

You can use this guide to connect your existing SIP infrastructure to Twilio to build a programmable inbound contact center. This allows you to use Twilio's logic to queue calls and route them to the appropriate agents.

To learn more advanced features that you can use with inbound contact centers, see Voice inbound contact center.

Enable PSTN connectivity with Twilio Programmable Voice

enable-pstn-connectivity-with-twilio-programmable-voice page anchor

You can use this guide to bridge your private SIP network with Twilio's reliable global PSTN network. This enables your business applications to reach phones anywhere in the world while maintaining your existing infrastructure.

To learn more advanced features that you can use with PSTN connectivity, see Voice PSTN connectivity.


After following this guide, you can successfully receive an inbound SIP call from your infrastructure to Twilio. You can verify this by checking your Twilio Console Call Logs to see the incoming SIP request and the execution of the programmable logic you configured.


Explore the following guides to build on what you've learned in this guide: