Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Voice in Twilio Flex


Flex offers basic functionality for inbound and outbound calling capabilites by default. You can augment existing calls using the Programmable Voice API. Programmable Voice can also be used, alongside other tools like Studio, to set up custom call flows.

Additionally, the Flex UI offers you the ability to customize existing behaviors for inbound and outbound calls using the Actions Framework and Notifications Framework.


Track Voice Usage

track-voice-usage page anchor

You can pull calls in your Flex account by using the Usage Records API and passing pstnconnectivity as the Category parameter. This will show your Programmable Voice usage over the PSTN (aka, the actual telephone network.)

Get PSTN Usage

get-pstn-usage page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.usage.records.list({category: 'pstnconnectivity', limit: 20})
_10
.then(records => records.forEach(r => console.log(r.asOf)));

Output

_41
{
_41
"end": 0,
_41
"first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records?Page=0&PageSize=1",
_41
"last_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records?Page=68&PageSize=1",
_41
"next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records?Page=1",
_41
"num_pages": 69,
_41
"page": 0,
_41
"page_size": 1,
_41
"previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records?Page=0&PageSize=1",
_41
"start": 0,
_41
"total": 69,
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records",
_41
"usage_records": [
_41
{
_41
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_41
"api_version": "2010-04-01",
_41
"as_of": "2019-06-24T22:32:49+00:00",
_41
"category": "totalprice",
_41
"count": null,
_41
"count_unit": "",
_41
"description": "Total Price",
_41
"end_date": "2015-09-04",
_41
"price": "2192.84855",
_41
"price_unit": "usd",
_41
"start_date": "2011-08-23",
_41
"subresource_uris": {
_41
"all_time": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records/AllTime.json?Category=totalprice",
_41
"daily": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records/Daily.json?Category=totalprice",
_41
"last_month": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records/LastMonth.json?Category=totalprice",
_41
"monthly": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records/Monthly.json?Category=totalprice",
_41
"this_month": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records/ThisMonth.json?Category=totalprice",
_41
"today": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records/Today.json?Category=totalprice",
_41
"yearly": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records/Yearly.json?Category=totalprice",
_41
"yesterday": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records/Yesterday.json?Category=totalprice"
_41
},
_41
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Usage/Records?Category=totalprice&StartDate=2011-08-23&EndDate=2015-09-04",
_41
"usage": "2192.84855",
_41
"usage_unit": "usd"
_41
}
_41
]
_41
}


Receiving a call is one of the basic interactions with the Flex UI. Other workflows, like making an outbound call or transferring a call, are more complex. The following end user guides explain how these interactions work in the Flex UI in more detail.



Rate this page: