BXML Verbs
BXML allows you to create a voice application as easily as you create a Web application. Using BXML, your application handles incoming call events using standard action verbs that are described in BXML.
Before we begin creating a new BXML application you’ll need two things initially setup:
A phone number that is allocated to your Bandwidth Application Platform account and is configured to an application. See here on how to do that. Note that when you create the application you’ll need to make sure that the Callback HTTP method is set to
GET
.A public Web site that you can create content on and will handle the requests for BXML. Note that the endpoint for this site should be used to create the application in you setup above.
The maximum size of a BXML document is 16 KB.
Understanding BXML Callback Events
The events sent are the events from Bandwidth Application Platform, with only two exceptions:
- transferComplete: sent to the original BXML call when the transferred call hangs up
- redirect: sent when the verb redirect is in action
BXML callbacks perform GET
requests to the requestUrl when the notification intends to retrieve a new BXML document.
BXML Verbs
Verb | Description |
---|---|
<Gather> |
The Gather verb is used to collect digits for some period of time. |
<Hangup> |
The Hangup verb is used to hangup current call. |
<PlayAudio> |
The PlayAudio verb is used to play an audio file in the call. |
<Pause> |
The Pause verb is used to pause the execution of an ongoing BXML document. |
<Record> |
The Record verb allows call recording. At the end of the call, a call recording event containing the media with recorded audio URL is generated |
<Redirect> |
The Redirect verb is used to redirect the current XML execution to another URL. |
<SendDtmf> |
The SendDtmf verb is used to is used to send digits on a live call. |
<SpeakSentence> |
The SpeakSentence verb is used to convert any text into speak for the caller. |
<Transfer> |
The Transfer verb is used to transfer the call to another number. |
BXML Callbacks
BXML events are HTTP messages that are sent to your application server to notify you of activity related to your Bandwidth resources during a BXML usage.
Event | Description |
---|---|
Answer Event | Bandwidth API sends this message to the application when the call is answered. |
Gather event | Bandwidth API generates a gather event when the gather command completes in a call. |
Hangup Event | Bandwidth API sends this message to the application when the call ends. |
Recording event | Bandwidth API sends this event to the application when an the recording media file is saved or an error occurs while saving it. |
Transcription event | Bandwidth API sends this event to the application when the recording media file is transcribed if requested. |
Redirect event | Bandwidth API sends this event to the application when a <Redirect> is requested |
Transfer Complete Event | Bandwidth API sends this event to the application when the <Transfer> is complete |