How to Build Your Flow Control With the Bandwidth API

When you place a call or an SMS, a bunch of things that are completely transparent to the end user are taking place under the hood of the telephony infrastructure: switching, call routing, event notifications, and more. For developers to build their own telephony apps or build telephony into existing apps, like, they need to be able to mimic the various legs of that process or what is known as "flow control."  Building your own flow control from scratch can be daunting which is why it could make sense to rely on an API that's equipped to deal with it.... Bandwidth is one such service.

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

Traditional Call Forward Flow with REST

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 calls and sms. BXML is almost always going to reduce your complexity and in some cases improve performance.

When the XML document is retrieved by Bandwidth, all of the actionable contacts are handled by Bandwidth internally. This results in a decreased latency which makes the customer interactions more ‘snappy’.

BXML Call Forward Flow

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 complexity can be contained in a single BXML document

<?xml version=”1.0" encoding=”UTF-8"?>
    <Transfer transferCallerId=”+15552221235”>
        <SpeakSentence gender=”male” locale=”en_US” voice=”paul”>This call has been forwarded.</SpeakSentence>

Be sure to read the next Telephony article: Twilio Unveils Cellular Communications Platform for Developers