We exmplify the easy of use of BXML by building a simple voicemail system. The structure below imitates the standard voicemail system. 1) When the call is answered, an automated voice says "Please leave a message after the tone" 2) A beep audio file gets played 3) The call starts recording 4) When the call is hung up, the recording callback gets printed in your terminal window and there you can see the recording URI in which you can access the recording

Use Cases

Use Case BXML Code
Transfer call to next available operator. If there is no answer after 10 seconds, then leave a voicemail <SpeakSentence voice="susan">Please wait for the next available operator</SpeakSentence>

Upon answering, an automated sentence is spoken (<SpeakSentence voice="susan">Please wait for the next available operator</SpeakSentence>). Then, nested in a </Transfer> verb, the call will transfer to one of a list of numbers. When the transferred gets picked up, a sentence is spoken - "This call has been forwarded", also nested in the Transfer verb. If nobody picks up after 10 sec, the call gets sent to voicemail (`</SpeakSentence></PlayAudio></Record>`)|


Change the baseUrl parameter. The recording will be sent to the callback URL: baseUrl + /recordResponse.

const baseUrl = `http://bc66e785.ngrok.io`;
const CALL_EVENTS = '/call-events';

const handleAnswerEvent = (req, res) => {
    if (req.query.eventType !== 'answer') {
    const bxml = `<?xml version="1.0" encoding="UTF-8"?>


                  <SpeakSentence voice="susan">Please leave a message after the tone</SpeakSentence>


                  <Record requestUrl="${baseUrl+'/recordResponse'}"></Record>



app.get(CALL_EVENTS, handleAnswerEvent);

app.get("/recordResponse", (req, res) => {

results matching ""

    No results matching ""