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


(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.


Great work!

Happy hacking!