Bandwidth provides an API to programmatically control phone numbers. What started as a fun idea, has grown into a massive service powering all sorts of businesses.
Traditionally, you would have to control each and every leg of a call flow with the REST API. While this is approach is incredibly powerful and flexible, you probably don’t need to manage all that yourself.
The REST API — Great power = Great Responsibility
Enter BXML (Bandwidth XML)
BXML is simply an XML document generated by your server (or you for simple use-cases) that instructs the Bandwidth Servers on how to handle your call/sms. BXML is almost always going to reduce your complexity and in some cases improve performance.
When the XML document is retrieved by Bandwidth, sll of the actionable contacts are handled by Bandwidth internally. This results in an decreased latency which makes the customer interactions more ‘snappy.’
Where BXML Really Shines
BXML can potentially make any call flow more straightforward. But it really shines when managing conference calls and simulring (ringing multiple phones and connecting the first to answer). Simulring via the REST API can ring unlimited phones and connect the first to answer. However, making each call, waiting for an answer event, answering the call, ending the other calls, bridging the two call legs, hanging up the calls when conversation is over, and ending the bridge is ALL handled in your application. If you only need to simulring a few phones, BXML is your new best friend!
All of that above complexitiy can be contained in a single BXML document.
<?xml version=”1.0" encoding=”UTF-8"?>
<SpeakSentence gender=”male” locale=”en_US” voice=”paul”>This call has been forwarded.</SpeakSentence>
Hacking up BXML with Github Gists
To demonstrate just HOW easy BXML can be. You don’t even need a server to get started with Bandwidth any more. You can hack up a simple call flow using Github Gists and BXML.
- Create a new Bandwidth Phone Number
2. Create a new Gist similar to the one below. Set the ‘transferCallerId’ value to the phone number you just ordered, set the ‘transferTo’ value to your cell phone, and name the end the file name with ‘.xml.’
<?xml version="1.0" encoding="UTF-8"?>
<SpeakSentence gender="male" locale="en_US" voice="paul">Transferring your call, please wait.</SpeakSentence>
<Transfer transferCallerId="+19842041410" transferTo="+14022561434">
<SpeakSentence gender="male" locale="en_US" voice="paul">Someone is calling you.</SpeakSentence>
3. Copy the RAW XML location from Github
4. Create a new application with the new phone number in the Bandwidth Console. Set the CALL URL to the RAW XML location from github. Set the HTTP method to GET and make sure that Auto-Answer is set to True. Then assign the newly ordered number to the Application.
5. Call your new Bandwidth number and watch your cell phone ring! Woah!
So by now you’re thinking: “Wow, that’s totally easy! Where can I learn more?” Just head over to our ‘How-to’ Guides to get started easily.