# Voice Calls

These views are only populated if your organization uses voice calling features.

## v\_VoiceCalls\_{TenantName}

Individual voice call records with timing metrics.

### Columns

| Column           | Type     | Description                             |
| ---------------- | -------- | --------------------------------------- |
| `conversationId` | varchar  | Link to parent conversation             |
| `QueueName`      | varchar  | Voice queue/team name                   |
| `CallDate`       | date     | Date of the call                        |
| `TaskStartedAt`  | datetime | When call entered queue                 |
| `CallStartedAt`  | datetime | When agent answered (null if abandoned) |
| `CallEndedAt`    | datetime | When call ended                         |
| `RingSeconds`    | int      | Time ringing before answer              |
| `TalkSeconds`    | int      | Duration of conversation                |
| `HandleSeconds`  | int      | Total handle time (talk + wrap-up)      |
| `IsAbandoned`    | int      | 1 if caller hung up before answer       |
| `IsHandled`      | int      | 1 if call was answered                  |

### Example Queries

```sql
-- Calls by date
SELECT
    CallDate,
    COUNT(*) AS TotalCalls,
    SUM(IsHandled) AS Answered,
    SUM(IsAbandoned) AS Abandoned
FROM v_VoiceCalls_YourCompany
GROUP BY CallDate
ORDER BY CallDate DESC

-- Average handle time by queue
SELECT
    QueueName,
    AVG(TalkSeconds) AS AvgTalkTime,
    AVG(RingSeconds) AS AvgWaitTime
FROM v_VoiceCalls_YourCompany
WHERE IsHandled = 1
GROUP BY QueueName

-- Abandonment rate by queue
SELECT
    QueueName,
    COUNT(*) AS TotalCalls,
    SUM(IsAbandoned) AS Abandoned,
    CAST(SUM(IsAbandoned) AS float) / COUNT(*) * 100 AS AbandonmentRate
FROM v_VoiceCalls_YourCompany
GROUP BY QueueName
```

***

## v\_VoiceCalls\_ByQueue\_Daily\_{TenantName}

Daily aggregated voice metrics by queue. Pre-calculated for dashboard performance.

### Columns

| Column               | Type    | Description                 |
| -------------------- | ------- | --------------------------- |
| `QueueName`          | varchar | Voice queue name            |
| `CallDate`           | date    | Date                        |
| `TotalIncomingCalls` | int     | Total calls received        |
| `HandledCalls`       | int     | Calls answered              |
| `AbandonedCalls`     | int     | Calls abandoned             |
| `AvgRingSeconds`     | float   | Average wait/ring time      |
| `AvgTalkSeconds`     | float   | Average talk duration       |
| `AvgWrapupSeconds`   | float   | Average wrap-up time        |
| `AvgHandleSeconds`   | float   | Average total handle time   |
| `AvgAbandonSeconds`  | float   | Average time before abandon |

### Example Queries

```sql
-- Daily call volume trend
SELECT CallDate, TotalIncomingCalls, HandledCalls, AbandonedCalls
FROM v_VoiceCalls_ByQueue_Daily_YourCompany
ORDER BY CallDate DESC

-- Service level by day (calls answered within 30 seconds)
SELECT
    CallDate,
    TotalIncomingCalls,
    HandledCalls,
    CASE WHEN AvgRingSeconds <= 30 THEN 'Met' ELSE 'Missed' END AS ServiceLevel
FROM v_VoiceCalls_ByQueue_Daily_YourCompany
ORDER BY CallDate DESC
```

***

## v\_VoiceCalls\_ByQueue\_AllTime\_{TenantName}

All-time aggregated voice metrics by queue.

### Columns

| Column               | Type    | Description            |
| -------------------- | ------- | ---------------------- |
| `QueueName`          | varchar | Voice queue name       |
| `TotalIncomingCalls` | int     | Total calls (all time) |
| `HandledCalls`       | int     | Total answered         |
| `AbandonedCalls`     | int     | Total abandoned        |
| `AvgRingSeconds`     | float   | Average wait/ring time |
| `AvgTalkSeconds`     | float   | Average talk duration  |
| `AvgWrapupSeconds`   | float   | Average wrap-up time   |
| `AvgHandleSeconds`   | float   | Average handle time    |
| `AvgAbandonSeconds`  | float   | Average abandon time   |

### Example Queries

```sql
-- Queue performance summary
SELECT
    QueueName,
    TotalIncomingCalls,
    HandledCalls,
    AbandonedCalls,
    ROUND(AvgRingSeconds, 1) AS AvgWaitSec,
    ROUND(AvgTalkSeconds, 1) AS AvgTalkSec
FROM v_VoiceCalls_ByQueue_AllTime_YourCompany
ORDER BY TotalIncomingCalls DESC
```

***

## Key Metrics Explained

| Metric               | Calculation                   | Description                  |
| -------------------- | ----------------------------- | ---------------------------- |
| **Ring Time**        | CallStartedAt - TaskStartedAt | How long the caller waited   |
| **Talk Time**        | CallEndedAt - CallStartedAt   | Actual conversation duration |
| **Handle Time**      | WrappedUpAt - CallStartedAt   | Talk + after-call work       |
| **Abandon Time**     | ClosedAt - TaskStartedAt      | Wait time before hangup      |
| **Abandonment Rate** | Abandoned / Total             | % of callers who hung up     |

{% hint style="warning" %}
**Tip:** Use the pre-aggregated `ByQueue_Daily` and `ByQueue_AllTime` views for dashboards. They perform much better than aggregating the raw `v_VoiceCalls` view.
{% endhint %}

{% hint style="info" %}
**Schema Compatibility:** These views automatically handle both the legacy JSON-based `voiceTaskMetadata` format (data before January 2026) and the newer flattened column format. No action is required - all historical data is accessible seamlessly.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://atender-labs.gitbook.io/atender-labs-docs/analytics/views/voice-calls.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
