Voice in Twilio Flex
Flex offers basic functionality for inbound and outbound calling capabilities 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.
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.)
_19// Download the helper library from https://www.twilio.com/docs/node/install
_19const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19// Find your Account SID and Auth Token at twilio.com/console
_19// and set the environment variables. See http://twil.io/secure
_19const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19const authToken = process.env.TWILIO_AUTH_TOKEN;
_19const client = twilio(accountSid, authToken);
_19async function listUsageRecord() {
_19 const records = await client.usage.records.list({
_19 category: "pstnconnectivity",
_19 records.forEach((r) => console.log(r.accountSid));
_41 "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records?Page=0&PageSize=1",
_41 "last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records?Page=68&PageSize=1",
_41 "next_page_uri": null,
_41 "previous_page_uri": null,
_41 "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records",
_41 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_41 "api_version": "2010-04-01",
_41 "as_of": "2019-06-24T22:32:49+00:00",
_41 "category": "totalprice",
_41 "description": "Total Price",
_41 "end_date": "2015-09-04",
_41 "price": "2192.84855",
_41 "start_date": "2011-08-23",
_41 "subresource_uris": {
_41 "all_time": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records/AllTime.json?Category=totalprice",
_41 "daily": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records/Daily.json?Category=totalprice",
_41 "last_month": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records/LastMonth.json?Category=totalprice",
_41 "monthly": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records/Monthly.json?Category=totalprice",
_41 "this_month": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records/ThisMonth.json?Category=totalprice",
_41 "today": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records/Today.json?Category=totalprice",
_41 "yearly": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records/Yearly.json?Category=totalprice",
_41 "yesterday": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records/Yesterday.json?Category=totalprice"
_41 "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage/Records?Category=totalprice&StartDate=2011-08-23&EndDate=2015-09-04",
_41 "usage": "2192.84855",
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.