# Configuring Elastic SIP Trunking as a Twilio BYOC Trunk Sinch Elastic SIP Trunking can easily be used with your Twilio applications. Follow this guide to learn how! ## Before you start Before you begin setting up your Sinch Elastic SIP trunk make sure you have done the following: * Sign up for a free account at https://www.sinch.com/ and request access for Elastic SIP Trunking. Need help? Click [here](https://community.sinch.com/t5/Customer-Dashboard/How-to-sign-up-for-your-free-Sinch-account/ta-p/8058) for instructions. * If you have not already done so, configure and create your Elastic SIP trunk. Instructions on how to do this can be found [here](https://community.sinch.com/t5/Elastic-SIP-Trunking/Getting-started-with-Elastic-SIP-Trunking/ta-p/11380). * Ensure you note the fully qualified domain name (FQDN) that was created on your SIP Trunk. You will need this while setting up your IP-PBX or SIP Application. * Add the Sinch Signaling IPs to your Twilio Access Control list. ## Configuring your BYOC Twilio Trunk 1. Log into your Twilio account and under “develop” navigate to Voice --> Manage --> BYOC Trunks and click the blue `+` button to add a new “Bring Your Own Carrier” (BYOC) Trunk. ![create new byoc trunk](/assets/twilio-new-trunk-1.5e872d93b761521de17a13c87dfdae8cd722f7b10929a8a12e5395c44edb5d43.f40ae551.png) 2. This opens up the general settings page for the BYOC trunk. Click the `+` button next to **Termination SIP Domains**. This will bring up a wizard to create a new Termination Domain. ![create new termination domain](/assets/twilio-termination-domains-2.34e75cc8a632a1317579915f36a5d35d1837afc4aab9cec1b0ffdf2f0e8f30ac.f40ae551.png) 3. Create a Termination SIP URI. This is the URL that you will send to when sending traffic towards Twilio. Add the ACL which contains the Sinch Elastic SIP Trunking signaling IPs to the trunk. ![add acl](/assets/twilio-configure-domains-3.ef88e8facf9bf05affd06a5d3f659100e66b272bcad2507a8ee63745cc90ba2d.f40ae551.png) Once done, click the “save” button at the bottom of the screen. 4. From the BYOC configuration screen, click the `+` button next to **Origination Connection Policy**. This will open the wizard where you will configure the settings to send calls out towards your Sinch Elastic SIP Trunk. ![create origination connection policy](/assets/twilio-connection-policy-4.691974cada4e5f66e903ab3b0835a8bdc9f6a5bef67f859adbb2b691262f056f.f40ae551.png) 5. Give your origination connection policy a friendly name to proceed to the configuration page. ![add friendly name](/assets/twilio-friendlyname-6.9459ef75466627bf616bb148f4b069561e9f04af6c6746985be1ac6933126948.f40ae551.png) 6. Once in the SIP Origination configuration screen select the blue + sign next to “Origination URI” to create a new entry. ![add sip URI](/assets/twilio-origination-5.b12e4be3cda544429dbe8fc804b5bbd157962871ea006e3d376703bb0676b4f0.f40ae551.png) In the Origination SIP URI modal dialog, enter the FQDN of your Sinch Elastic SIP Trunk. This needs to be entered as a SIP URI. So preface it with `sip:`. For example, if your Sinch SIP Trunk FQDN was `mysinchtrunk.pstn.sinch.com`, you would enter `sip:mysinchtrunk.pstn.sinch.com`. Then click the **Create** button. 7. Once finished, click the **Save** button. ![click save](/assets/twilio-save-7.e7a1944025468cdb43f1321947cef2ff5d559a2787566dfbce7b4f510ce9d132.f40ae551.png) 8. BYOC configuration allows the customer to use Twilio for programmable voice but to use a 3rd party number and termination provider instead of Twilio. You will need the BYOC trunk ID in order to instruct your application which BYOC trunk it should use when using the `` method. ![specify byoc trunk id](/assets/twilio-byoc-8.eca24b7b501acccb0c7e9d3dc13d30b5d8da2743bdec4e4f0c752e28fc0c2036.f40ae551.png) See an example of this change in the image below. ![adding code](/assets/twilio-code-9.d0b25afb49f4f36e0be00c5df9346945a5423d5c0ec01fa2799cf9de9d291d4c.f40ae551.png) Together with the Origination Connection Policy defined earlier this will ensure that Sinch is used to terminate any PSTN call that your application needs to make. ## Create your Sinch Endpoint 1. Navigate to your Elastic SIP Trunk in your [Sinch Build Dashboard](https://dashboard.sinch.com/trunks/your-trunks). You must create a new SIP Endpoint which points to your Twilio Trunk FQDN. ![add sip endpoint](/assets/twilio-sinch-dashboard-10.92bc4a6df24c0d6594bb8a7cc0107a2af97e7ccec0942dd052f86e3620d42fbc.f40ae551.png) 2. In the new SIP Endpoint wizard, add a friendly name for the endpoint and enter the FQDN of your Twilio BYOC trunk. This is the FQDN you created in the Twilio portal under “Termination SIP Domains.” Once done click **Create**. ![specify twilio trunk](/assets/twilio-sinch-dashboard-11.7514899ac208a1e0c17dc3fda45980733d7a275dbcb55e7bd9fa3f404c19e58e.f40ae551.png) It is important to note that these changes will not take effect until you click the **Update SIP Trunk** button at the bottom of the page. 3. In the Sinch Build Dashboard, navigate to the **Access Control List** section and add your [Twilio IP addresses](https://www.twilio.com/docs/sip-trunking/ip-addresses) to the ACL which is configured on your SIP Trunk. ![add twilio ip addresses](/assets/twilio-sinch-dashboard-12.1b2a200a31b328d0324106369eba80938f570f74d94681deb91a1f4cccc53b3d.f40ae551.png) 4. Save your configuration and now your Elastic SIP trunk should be operational and ready for traffic. Assign a number to your trunk and give it a try!