A Call Metric is an object representing
related to the quality of a voice call.
Using the Call Metrics Resource, you can read a list of Call Metrics for a specified voice call.
Voice Insights Advanced Features must be active to use this API Resource.
Metrics are typically available via the API within 90 seconds of call completion.
The following table details the properties of a single Call Metric sample instance.
Timestamp of metric sample. Samples are taken every 10 seconds and contain the metrics for the previous 10 seconds.
The unique SID identifier of the Call.
^CA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique SID identifier of the Account.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The Twilio media edge this Metric was captured on. One of unknown_edge
, carrier_edge
, sip_edge
, sdk_edge
or client_edge
.
unknown_edge
carrier_edge
sip_edge
sdk_edge
client_edge
The Direction of the media stream from the perspective of the Twilio media edge. One of unknown
, inbound
, outbound
or both
.
unknown
inbound
outbound
both
Contains metrics and properties for the Twilio media gateway of a PSTN call.
Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call.
Contains metrics and properties for the SDK sensor library for Client calls.
Contains metrics and properties for the Twilio media gateway of a Client call.
Metric samples from these edges contain the following properties:
Property | Description |
---|---|
codec | RTP profile number of the detected codec |
codec_name | Name of the detected codec |
cumulative | Cumulative jitter (max/avg), packets lost, and packet count for the stream received at this edge |
interval | sdk_edge : audio in/out, jitter, packet loss, rtt, and packet loss percentage for the sampling interval. _All other edge_s: packets received, packets lost, and packet loss percentage. |
metadata | Twilio media region of the selected edge, Twilio and endpoint IP media IP addresses |
GET https://insights.twilio.com/v1/Voice/{CallSid}/Metrics
Use this action to retrieve a list of Call Metrics for the specified voice call.
You can use the optional edge
parameter to filter the list by media edge. See Understanding Twilio Media Edges for more information.
If no edge
parameter is provided, the resulting list will depend on the call type:
Call Type | Default Edge | Additional Edge |
---|---|---|
Carrier | carrier_edge | N/A |
SIP | sip_edge | N/A |
Client | sdk_edge | client_edge |
Trunking Originating | carrier_edge | sip_edge |
Trunking Terminating | sip_edge | carrier_edge |
The unique SID identifier of the Call.
^CA[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The Edge of this Metric. One of unknown_edge
, carrier_edge
, sip_edge
, sdk_edge
or client_edge
.
unknown_edge
carrier_edge
sip_edge
sdk_edge
client_edge
The Direction of this Metric. One of unknown
, inbound
, outbound
or both
.
unknown
inbound
outbound
both
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listMetric() {11const metrics = await client.insights.v112.calls("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")13.metrics.list({ limit: 20 });1415metrics.forEach((m) => console.log(m.timestamp));16}1718listMetric();
1{2"meta": {3"page": 10,4"page_size": 5,5"first_page_url": "https://insights.twilio.com/v1/Voice/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Metrics?Direction=both&Edge=sdk_edge&PageSize=5&Page=0",6"previous_page_url": "https://insights.twilio.com/v1/Voice/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Metrics?Direction=both&Edge=sdk_edge&PageSize=5&Page=9&PageToken=DP10",7"next_page_url": null,8"key": "metrics",9"url": "https://insights.twilio.com/v1/Voice/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Metrics?Direction=both&Edge=sdk_edge&PageSize=5&Page=10"10},11"metrics": [12{13"timestamp": "2019-10-07T22:32:06Z",14"call_sid": "CA7569efe0253644fa4a88aa97beca3310",15"account_sid": "AC998c10b68cbfda9f67277f7d8f4439c9",16"edge": "sdk_edge",17"direction": "both",18"sdk_edge": {19"interval": {20"packets_received": 50,21"packets_lost": 0,22"audio_in": {23"value": 8124},25"audio_out": {26"value": 523727},28"jitter": {29"value": 930},31"mos": {32"value": 4.3933},34"rtt": {35"value": 8136}37},38"cumulative": {39"bytes_received": 547788,40"bytes_sent": 329425,41"packets_received": 3900,42"packets_lost": 0,43"packets_sent": 393444}45},46"client_edge": null,47"carrier_edge": null,48"sip_edge": null49}50]51}
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listMetric() {11const metrics = await client.insights.v112.calls("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")13.metrics.list({14edge: "sdk_edge",15limit: 20,16});1718metrics.forEach((m) => console.log(m.timestamp));19}2021listMetric();
1{2"meta": {3"page": 0,4"page_size": 50,5"first_page_url": "https://insights.twilio.com/v1/Voice/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Metrics?PageSize=50&Page=0",6"previous_page_url": null,7"next_page_url": null,8"key": "metrics",9"url": "https://insights.twilio.com/v1/Voice/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Metrics?PageSize=50&Page=0"10},11"metrics": [12{13"timestamp": "2019-10-07T22:32:06Z",14"call_sid": "CA7569efe0253644fa4a88aa97beca3310",15"account_sid": "AC998c10b68cbfda9f67277f7d8f4439c9",16"edge": "sdk_edge",17"direction": "both",18"sdk_edge": {19"interval": {20"packets_received": 50,21"packets_lost": 0,22"audio_in": {23"value": 8124},25"audio_out": {26"value": 523727},28"jitter": {29"value": 930},31"mos": {32"value": 4.3933},34"rtt": {35"value": 8136}37},38"cumulative": {39"bytes_received": 547788,40"bytes_sent": 329425,41"packets_received": 3900,42"packets_lost": 0,43"packets_sent": 393444}45},46"client_edge": null,47"carrier_edge": null,48"sip_edge": null49}50]51}