How to route calls to your SIP network with an outbound call
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!
Learn to programmatically route calls to your SIP network with Twilio Programmable Voice using the Twilio API to create a Call resource or a TwiML Bin to initiate a SIP connection. You can use this guide to send voice notifications, automate self-service tasks, build inbound and outbound contact centers, provide PSTN connectivity, and capture audio for AI or ML transcription.
See Related reference documentation to learn more about the SIP registration, SIP domains, and SIP endpoints used in this guide.
- Buy a Twilio Number
- Configure SIP Registration
- Configure your SIP Endpoint
- Make an outbound SIP call
Let's get started!
In the Twilio console, search for and purchase an available phone number capable of making outbound calls. You'll use this phone number as the "From" phone number when you initiate an outbound call.

Note: If you are not using Twilio Registered Endpoint then this step is not applicable to you.
In order to make and receive phone calls to a SIP phone, like Zoiper, SIP Registration is required. This enables routing the calls to SIP phone/Endpoint. In this tutorial, we are using a Twilio Registered Endpoint to receive the call. This guide will show how to enable registration and setup credentials.
-
Configure a Credential List.
Twilio ConsoleLegacy Console- Open Twilio Console and go to Voice > SIP Domains > Credential Lists.
- Select Create Credential List.
- Enter a Credential list friendly name of
Endpoint. - In the Add credentials section, enter a Username (this can be an E.164 number, extension number, or name) of
UserAand a Password ofyourpassword. - Select Save.
These credentials are used by your SIP Endpoints to authenticate with Twilio.
-
Configure a SIP Domain.
Twilio ConsoleLegacy Console- Open Twilio Console and go to Voice > SIP Domains.
- Select Create SIP Domain.
- In the Properties section, enter a SIP domain friendly name of
T1and a SIP URI ofTrunk1. SIP URIs must be unique across Twilio — ifTrunk1is taken, choose another name. - In the Voice authentication section, select the
Endpointcredential list from Credential lists. - Select Create.
- On the SIP Domain details page, find the SIP registration section and select Edit SIP registration.
- Set Enable SIP registration to Enabled.
- Select the
Endpointcredential list from Credential lists. - Select Save.
Note: If you are not using Twilio Registered Endpoint then this step is not applicable to you.
A SIP Endpoint can be desk phone or soft phone. In this guide, we will use the soft phone and will configure the phone to successfully register to SIP Registrar.
-
Download and install SIP Endpoint. Zoiper is used for example
-
Provide login name -
UserA@Trunk1.sip.us1.twilio.com(do add us1 region parameter to your sip domain) and password- Username and password from your Credential List in Twilio Console or the legacy Console.
- Yourdomain from your SIP Domain in Twilio Console or the legacy Console. For example,
Trunk1.sip.us1.twilio.com(do add us1 region parameter to your sip domain while configuring zoiper).
-
Click "Next/continue" to confirm the Domain.
-
Optional settings can be skipped
-
Done! You see in Zoiper that it is "Registered" and has "Tick" next to your login name.
-
You can also verify the successfully registered endpoints in the Registered SIP Endpoints section of your SIP Domain page in Twilio Console.
There are a couple of ways that you can make an outbound SIP call from Twilio. Remember this outbound call that Twilio makes is what will connect with your SIP Network.
It's possible to have Twilio run code when a call is received. For our example, we will have that code make an outbound SIP call to our network.
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 page and click the + icon to add a new bin.
Set the Friendly Name as SIP Outbound call and copy and paste the TwiML below
1<?xml version="1.0" encoding="UTF-8"?>2<Response>3<Say>Welcome to xyz.com. Your call will be routed to an agent now</Say>4<Dial>5<Sip>sip:UserA@Trunk1.sip.us1.twilio.com</Sip>6</Dial>7</Response>8
Info
Make sure to add us1 region parameter as part of your SIP domain
With our TwiML Bin created, now we need to wire it up to our number.
- Go to your Twilio Number page
- Click the Number you have purchased
- Scroll down to "Voice" under "A Call Comes in" select your configured TwiML Bin as
SIP Outbound callfrom the dropdown menu and click "Save"

Take your cellphone and dial the Twilio Number you purchased. You should hear a notification that you are being transferred and then an outbound SIP call will be made. Congratulations!
Another way to make an outbound call is by using the REST API. Here we will create a Call resource and point it directly to our SIP client.
First, you'll need to get your Twilio account credentials. They consist of your AccountSid and your Auth Token. They can be found on the home page of the console.

There are a few key parameters to drill into when making the outbound call.
- "From" - the username or number you are calling from
- "To" - login name of your SIP Endpoint (Zoiper). For example,
sip:UserA@Trunk1.sip.us1.twilio.com(do add us1 as a region parameter to your SIP Domain) - "TwiML" - The TwiML instructions on what should happen when the other party picks up the phone.
Visit the TwiML Bin page and click the + icon to add a new bin.
Set the Friendly Name as Notification and copy and paste the TwiML below
1<?xml version="1.0" encoding="UTF-8"?>2<Response>3<Say>Well done you have successfully made an outbound SIP call from Twilio using an API</Say>4</Response>
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createCall() {11const call = await client.calls.create({12from: "+15017122661",13to: "sip:UserA@Trunk1.sip.us1.twilio.com",14twiml:15"<Response><Say>Hello and thanks for connecting to your SIP network!</Say></Response>",16});1718console.log(call.sid);19}2021createCall();
Response
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"answered_by": null,4"api_version": "2010-04-01",5"caller_name": null,6"date_created": "Tue, 31 Aug 2010 20:36:28 +0000",7"date_updated": "Tue, 31 Aug 2010 20:36:44 +0000",8"direction": "inbound",9"duration": "15",10"end_time": "Tue, 31 Aug 2010 20:36:44 +0000",11"forwarded_from": "+141586753093",12"from": "+15017122661",13"from_formatted": "(415) 867-5308",14"group_sid": null,15"parent_call_sid": null,16"phone_number_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"price": "-0.03000",18"price_unit": "USD",19"sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",20"start_time": "Tue, 31 Aug 2010 20:36:29 +0000",21"status": "completed",22"subresource_uris": {23"notifications": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications.json",24"recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings.json",25"payments": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Payments.json",26"events": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events.json",27"siprec": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Siprec.json",28"streams": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams.json",29"transcriptions": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Transcriptions.json",30"user_defined_message_subscriptions": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/UserDefinedMessageSubscriptions.json",31"user_defined_messages": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/UserDefinedMessages.json"32},33"to": "sip:UserA@Trunk1.sip.us1.twilio.com",34"to_formatted": "(415) 867-5309",35"trunk_sid": null,36"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",37"queue_time": "1000"38}
Run the code. You should hear a notification that you have successfully made an outbound SIP call.
This guide teaches the basics required for the following use cases:
You can use this guide to send voice notifications using your app. For example, you can programmatically call customers to notify them of important updates, such as emergency weather closings.
To learn more advanced features that you can use with voice notifications, see Voice notifications.
You can use this guide together with the <Gather> TwiML verb to collect keypad input from callers for self-service automation.
To learn more advanced features that you can use with self-service automation, see Voice self-service automation.
You can use this guide to route incoming PSTN calls directly to your existing SIP infrastructure for agent handling.
To learn more advanced features that you can use with inbound contact centers, see Voice inbound contact center.
You can use this guide to create a programmatic outbound call center that dials customers for telemarketing or support follow-ups.
To learn more advanced features that you can use with outbound contact centers, see Voice outbound contact center.
You can use this guide to bridge the gap between traditional telephone networks and your private SIP network.
To learn more advanced features that you can use with PSTN connectivity, see Voice PSTN connectivity.
You can use this guide to capture the audio of your outbound SIP calls for AI-driven analysis.
To learn more advanced features that you can use with AI or ML transcription, see Voice AI and ML transcription.
After following this guide, you can make an outbound call programmatically to a SIP endpoint with Twilio Programmable Voice. You should hear a notification or your TwiML greeting when the SIP client answers, confirming that the call has been successfully routed to your SIP network.
Explore the following guides to build on what you've learned in this guide:
- How to add Programmability to your existing SIP network: Learn how to add Twilio features to your existing SIP infrastructure.
- SIP: Read the high-level overview of SIP interface features and capabilities.
- SIP Quickstart: Get a SIP domain and endpoint running quickly with this step-by-step guide.