BYOC for Twilio Programmable VoiceFollow
Important: Before learning how to use your Bandwidth numbers with Twilio Programmable Voice, make sure to complete the steps outlined in our BYOC for Twilio setup guide.
Similarly to Bandwidth’s Voice API, the Twilio Programmable Voice API gives developers programmatic control over their calls. The wide variety of uses include basic phone-to-phone calling, app-to-phone calling, Interactive Voice Response (IVR), conference calling, SIP interfacing, call recording, transcription, and call tracking.
Your TwiML application
If you've already created your TwiML application, then complete the following steps:
- Go to your SIP domain created in the Twilio: Setting up a SIP Domain section of our BYOC for Twilio setup guide.
- Specify your TwiML app for the Call Control Configuration section. The Voice Request URL will be the same as your existing TwiML app.
- Click Save.
- All set! Now place a call to the Bandwidth number you're using for testing and it should reach Twilio.
Sample TwiML application
If you haven't created your TwiML application, you can use the following sample application as a demonstration. We’ll use a Twilio app that's an IVR, which prompts callers and connects them to an available agent.
From the Twilio standpoint, your app will look exactly as it did if you bought your numbers through Twilio. The inbound calls will trigger a request for TwiML, and your application will respond.
Here’s what the sample TwiML looks like:
We’re using the <Gather> command and prompting a caller to press a digit to connect to an agent by using <Say>. When they respond by pressing a digit, we’re going to connect them via the <Dial> verb.
Once you set the Voice Request URL in your SIP domain to this hosted TwiML application (using the steps outlined in Your TwiML application), all inbound calls will prompt the user to press a digit.