# Call Insights Event Resource

A **Call Insights Event** is an object representing an event which occurred during a voice call.

Call Events can be:

* [call progress events](/docs/voice/api/call-resource#statuscallbackevent), or
* [Voice SDK quality events](/docs/voice/voice-insights/api/call/details-sdk-call-quality-events).

Using the **Call Insights Event Resource**, you can [read a list of Call Insights Events for a specific voice call](#read-multiple-call-insights-event-resources).

> \[!WARNING]
>
> [Voice Insights Advanced Features](/docs/voice/voice-insights/advanced-features) must be active to use this API Resource.

> \[!WARNING]
>
> Voice Insights for mobile SDKs is supported for versions 3.x and later. Calls placed using 2.x mobile SDKs are not supported and details are provided as-is and may not be reliable indicators of actual behavior on the handset.

> \[!NOTE]
>
> Events are typically available via the API within 90 seconds.

## Call Insights Event properties

The following table details the properties of a single Call Insights Event instance.

```json
{"type":"object","refName":"insights.v1.call.event","modelName":"insights_v1_call_event","properties":{"timestamp":{"type":"string","nullable":true,"description":"Event time."},"call_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^CA[0-9a-fA-F]{32}$","nullable":true,"description":"The unique SID identifier of the Call."},"account_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$","nullable":true,"description":"The unique SID identifier of the Account."},"edge":{"type":"string","nullable":true,"description":"The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.","enum":["unknown_edge","carrier_edge","sip_edge","sdk_edge","client_edge"],"refName":"event_enum_twilio_edge","modelName":"event_enum_twilio_edge"},"group":{"type":"string","nullable":true,"description":"Event group."},"level":{"type":"string","nullable":true,"description":"The Level of this Event. One of `UNKNOWN`, `DEBUG`, `INFO`, `WARNING` or `ERROR`.","enum":["UNKNOWN","DEBUG","INFO","WARNING","ERROR"],"refName":"event_enum_level","modelName":"event_enum_level"},"name":{"type":"string","nullable":true,"description":"Event name."},"carrier_edge":{"nullable":true,"description":"Represents the connection between Twilio and our immediate carrier partners. The events here describe the call lifecycle as reported by Twilio's carrier media gateways."},"sip_edge":{"nullable":true,"description":"Represents the Twilio media gateway for SIP interface and SIP trunking calls. The events here describe the call lifecycle as reported by Twilio's public media gateways."},"sdk_edge":{"nullable":true,"description":"Represents the Voice SDK running locally in the browser or in the Android/iOS application. The events here are emitted by the Voice SDK in response to certain call progress events, network changes, or call quality conditions."},"client_edge":{"nullable":true,"description":"Represents the Twilio media gateway for Client calls. The events here describe the call lifecycle as reported by Twilio's Voice SDK media gateways."}}}
```

## Read multiple Call Insights Event resources

`GET https://insights.twilio.com/v1/Voice/{CallSid}/Events`

Use this action to retrieve a list of Call Insights Events for the specified voice call.

You can use the optional `edge` parameter to filter the list by media edge. See [Understanding Twilio Media Edges](/docs/voice/voice-insights/api/call/understanding-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`      |

### Path parameters

```json
[{"name":"CallSid","in":"path","description":"The unique SID identifier of the Call.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^CA[0-9a-fA-F]{32}$"},"required":true}]
```

### Query parameters

```json
[{"name":"Edge","in":"query","description":"The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.","schema":{"type":"string","enum":["unknown_edge","carrier_edge","sip_edge","sdk_edge","client_edge"],"refName":"event_enum_twilio_edge","modelName":"event_enum_twilio_edge"}},{"name":"PageSize","in":"query","description":"How many resources to return in each list page. The default is 50, and the maximum is 1000.","schema":{"type":"integer","format":"int64","minimum":1,"maximum":1000}},{"name":"Page","in":"query","description":"The page index. This value is simply for client state.","schema":{"type":"integer","minimum":0}},{"name":"PageToken","in":"query","description":"The page token. This is provided by the API.","schema":{"type":"string"}}]
```

Read multiple Call Insights Events for a Call

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function listEvent() {
  const events = await client.insights.v1
    .calls("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
    .events.list({ limit: 20 });

  events.forEach((e) => console.log(e.timestamp));
}

listEvent();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

events = client.insights.v1.calls(
    "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
).events.list(limit=20)

for record in events:
    print(record.timestamp)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Insights.V1.Call;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var _events = await EventResource.ReadAsync(
            pathCallSid: "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", limit: 20);

        foreach (var record in _events) {
            Console.WriteLine(record.Timestamp);
        }
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.insights.v1.call.Event;
import com.twilio.base.ResourceSet;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        ResourceSet<Event> events = Event.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").limit(20).read();

        for (Event record : events) {
            System.out.println(record.getTimestamp());
        }
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	insights "github.com/twilio/twilio-go/rest/insights/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &insights.ListEventParams{}
	params.SetLimit(20)

	resp, err := client.InsightsV1.ListEvent("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].Timestamp != nil {
				fmt.Println(*resp[record].Timestamp)
			} else {
				fmt.Println(resp[record].Timestamp)
			}
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$events = $twilio->insights->v1
    ->calls("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
    ->events->read([], 20);

foreach ($events as $record) {
    print $record->timestamp;
}
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

events = @client
         .insights
         .v1
         .calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
         .events
         .list(limit: 20)

events.each do |record|
   puts record.timestamp
end
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:insights:v1:voice:events:list \
   --call-sid CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

```bash
curl -X GET "https://insights.twilio.com/v1/Voice/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events?PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "meta": {
    "page": 0,
    "page_size": 50,
    "first_page_url": "https://insights.twilio.com/v1/Voice/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events?PageSize=50&Page=0",
    "previous_page_url": null,
    "next_page_url": null,
    "key": "events",
    "url": "https://insights.twilio.com/v1/Voice/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events?PageSize=50&Page=0"
  },
  "events": [
    {
      "timestamp": "2019-09-19T22:15:23Z",
      "call_sid": "CA03a02b156c6faa96c86906f7e9ad0f38",
      "account_sid": "AC998c10b68cbfda9f67277f7d8f4439c9",
      "edge": "sdk_edge",
      "group": "connection",
      "name": "error",
      "level": "ERROR",
      "sdk_edge": {
        "error": {
          "code": 31600
        },
        "metadata": {
          "client_name": "GTI9300323095d271b890c91568931321395",
          "location": {
            "lat": 37.4192,
            "lon": -122.0574
          },
          "city": "Mountain View",
          "country_code": "US",
          "country_subdivision": "California",
          "ip_address": "108.177.7.83",
          "sdk": {
            "type": "twilio-voice-android",
            "version": "4.5.1",
            "platform": "android",
            "selected_region": "gll",
            "os": {
              "name": "android",
              "version": "4.3"
            },
            "device": {
              "model": "GT-I9300",
              "type": "GT-I9300",
              "vendor": "samsung",
              "arch": "armeabi-v7a"
            }
          }
        }
      },
      "client_edge": null,
      "carrier_edge": null,
      "sip_edge": null
    }
  ]
}
```

Read multiple Call Insights Events for a Call filtered by Media Edge

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function listEvent() {
  const events = await client.insights.v1
    .calls("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
    .events.list({
      edge: "sdk_edge",
      limit: 20,
    });

  events.forEach((e) => console.log(e.timestamp));
}

listEvent();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

events = client.insights.v1.calls(
    "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
).events.list(edge="sdk_edge", limit=20)

for record in events:
    print(record.timestamp)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Insights.V1.Call;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var _events = await EventResource.ReadAsync(
            pathCallSid: "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            edge: EventResource.TwilioEdgeEnum.SdkEdge,
            limit: 20);

        foreach (var record in _events) {
            Console.WriteLine(record.Timestamp);
        }
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.insights.v1.call.Event;
import com.twilio.base.ResourceSet;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        ResourceSet<Event> events =
            Event.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setEdge(Event.TwilioEdge.SDK_EDGE).limit(20).read();

        for (Event record : events) {
            System.out.println(record.getTimestamp());
        }
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	insights "github.com/twilio/twilio-go/rest/insights/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &insights.ListEventParams{}
	params.SetEdge("sdk_edge")
	params.SetLimit(20)

	resp, err := client.InsightsV1.ListEvent("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].Timestamp != nil {
				fmt.Println(*resp[record].Timestamp)
			} else {
				fmt.Println(resp[record].Timestamp)
			}
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$events = $twilio->insights->v1
    ->calls("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
    ->events->read(["edge" => "sdk_edge"], 20);

foreach ($events as $record) {
    print $record->timestamp;
}
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

events = @client
         .insights
         .v1
         .calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
         .events
         .list(
           edge: 'sdk_edge',
           limit: 20
         )

events.each do |record|
   puts record.timestamp
end
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:insights:v1:voice:events:list \
   --call-sid CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
   --edge sdk_edge
```

```bash
curl -X GET "https://insights.twilio.com/v1/Voice/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events?Edge=sdk_edge&PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "meta": {
    "page": 0,
    "page_size": 50,
    "first_page_url": "https://insights.twilio.com/v1/Voice/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events?PageSize=50&Page=0",
    "previous_page_url": null,
    "next_page_url": null,
    "key": "events",
    "url": "https://insights.twilio.com/v1/Voice/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events?PageSize=50&Page=0"
  },
  "events": [
    {
      "timestamp": "2019-09-19T22:15:23Z",
      "call_sid": "CA03a02b156c6faa96c86906f7e9ad0f38",
      "account_sid": "AC998c10b68cbfda9f67277f7d8f4439c9",
      "edge": "sdk_edge",
      "group": "connection",
      "name": "error",
      "level": "ERROR",
      "sdk_edge": {
        "error": {
          "code": 31600
        },
        "metadata": {
          "client_name": "GTI9300323095d271b890c91568931321395",
          "location": {
            "lat": 37.4192,
            "lon": -122.0574
          },
          "city": "Mountain View",
          "country_code": "US",
          "country_subdivision": "California",
          "ip_address": "108.177.7.83",
          "sdk": {
            "type": "twilio-voice-android",
            "version": "4.5.1",
            "platform": "android",
            "selected_region": "gll",
            "os": {
              "name": "android",
              "version": "4.3"
            },
            "device": {
              "model": "GT-I9300",
              "type": "GT-I9300",
              "vendor": "samsung",
              "arch": "armeabi-v7a"
            }
          }
        }
      },
      "client_edge": null,
      "carrier_edge": null,
      "sip_edge": null
    }
  ]
}
```
