Stream Liner

Author Ellinor Niklasson

Last updated: December 13th, 2024 by Ellinor Niklasson

Introduction

This document outlines the structure and purpose of the Statistics product “Stream Liner”.  
This product provides a JSON, which is designed to transmit real-time call data, including call statistics, interactions, queues, agents, and durations.

Overview

The provided JSON represents an "overview call" where each phone call, irrespective of queue jumps or multiple agents, is treated as a single, unique interaction.

This approach consolidates the entire call journey into one document, meaning secondary calls within the same interaction (due to transfers or queues) are not treated as separate entities but as part of the same call.

For example, a call that jumps between several queues or is answered by multiple agents will still be recorded as one call within the JSON document, providing a comprehensive overview of the call’s history. 

Step By Step Guide

How to connect

Your url : wss://statistics-webhook.telavox.se/
Your token:  👇

Get your token

  1. Go to Telavox desktop app or webagent.
  2. Click on Settings.
  3. Go to My Account
  4. Click on Username and password
  5. Click on Integration Manage Token
  6. Click on Create new Statistics Token
  7. Copy paste the code below, add your url +  token, and … time to stream!

Download the “Hello world” code in here: just get data 
Download advanced code in here: data is received and stored in a json file

Example 1 

Example 2 : Get just my data

General Considerations

Data Existence

Some fields (such as start, end, answer, id_call, call_direction, customer_telavox, duration, active) are always present. Others, such as agent or queue data, are conditional and only appear if the information is relevant to that specific call. For example, if the phone call does not enter in any queue, there will be no queue objects.

Refresh Rate

The JSON document is updated in real-time as the call progresses. While the call is ongoing, the field active will be set to 1. Once the call ends, the remaining fields such as end date and total duration will be filled in. Updates occur during the following events:

  • Call starts
  • Call enters a queue
  • Agent answers
  • Call ends

Call Participants
A call may involve multiple participants (agents, queues, IVR transfers, etc.). To avoid overwhelming data, the JSON includes the concepts of xxx_first and xxx_last, indicating the first and last actor involved. Additionally, there’s a xxx_list to capture all participants involved, if needed in an array format.
For example, if there are 4 agents in a phone call, we’ll fully inform the first and the last. The others will be included in an array list.
 

Overview Json Example

 


Fields

  1. id_call
    Description: The unique identifier of the phone call. This call ID remains constant throughout all queue jumps, transfers, or other events that occur during the call.
    Type: String (UUID)
    Example: "id_call": “37b02743-b4e8-47b1-a5d0-3e7000f0fe55”
     
  2. answered
    Description: Indicates whether the call has been answered or not from an overall perspective. This flag will not be to “1” if it's just picked by an ivr. Just for  a human. 
    Type: Integer (Boolean-like: 1 for answered, 0 for not answered)
    Example: "answered": 1
     
  3. offered_and_answered
    Description: The number of times the call was offered to an agent and successfully answered.
    Type: Integer
    Example: "offered_and_answered": 4
     
  4. offered_and_not_answered
    Description: The number of times the call was offered to an agent but not answered. This is counted if the call was offered for more than 1 second.
    Type: Integer
    Example: "offered_and_not_answered": 1
     
  5. terminated_call_reason
    Description: The reason the call ended.
    Type: String
    Values:
    hangup / no_answer / busy / failed / redirect_no_answer / redirect_not_reachable / redirect_user_busy / toggle / queue_leave_abandon / queue_leave_digit / queue_leave_empty / queue_leave_timeout / queue_ohw_no_answer / queue_ohw_no_confirmation / queue_leave_full / redirect / answered_elsewhere / blind_transferred / at_complete / at_cancel / ivr_timeout / ivr_closed / bridged / answered_by_other_terminal / ivr_timeout / ivr_closed.
    Example: "terminated_call_reason": “queue_leave_empty”
     
  6. simultaneous_device_calls
    Description: Indicates how many devices were ringing simultaneously during the call.
    Type: Integer
    Example: "simultaneous_device_calls": 1
     
  7. active
    Description: Indicates if the call is currently active.
    Type: Integer (Boolean-like: 1 for active, 0 for not active)
    Example: "active": 0
     
  8. voicemail
    Description: Indicates whether the call resulted in a personal voicemail (only phone calls, not chats etc)
    Type: Integer (Boolean-like: 1 for voicemail, 0 for no voicemail)
    Example: "voicemail": 1
     
  9. recorded
    Description: Indicates if the call was recorded.
    Type: Integer (Boolean-like: 1 for recorded, 0 for not recorded)
    Example: "recorded": 0
     
  10. direction
    Description: Specifies the direction of the call, whether it was incoming or outgoing.
    Type: String
    Values:
    incoming: The call was received.
    outgoing: The call was placed to a customer.
    Example: "direction": “incoming”
     
  11. time
    Description: Timestamps marking the start and end of the call, representing the absolute first and last interactions regardless of events during the call.
    Fields:
    start: Timestamp of the first interaction (in milliseconds).
    end: Timestamp of the last interaction (in milliseconds).
    Type: Object
    Example: "time": { "start": 1724407983816, "end": 1724408065261 }
     
  12. customer_target
    Description: The phone number of the customer involved in the call. This is the caller’s number for inbound calls, and the recipient’s number for outbound calls.
    Fields:
    number: Customer phone number.
    Type: Object
    Example: "customer_target": { "number": "0034935475858" }
     
  13. customer_telavox
    Description: Information about the Telavox account associated with the call, including the account ID and name.
    Fields:
    id: Unique identifier for the Telavox account.
    name: Name of the Telavox account.
    Type: Object
    Example: "customer_telavox": { "id": "285964", "name": "Statistics Demo"}
     
  14. on_hooked_calls
    Description: Information about calls where the customer requested not to wait in the queue, opting for a callback instead.
    Fields:
    no_wait_request: The customer does not accept a callback.
    answer_wait_request: The customer accepted to have a callback
    customer_no_answer: The customer failed to answer the callback despite the agent called back. 
    Type: Object
    Example: "on_hooked_calls": { "no_wait_request": 1, "answer_wait_request": 1, "customer_no_answer": 1 }
     
  15. agent_list
    Description: A list of all agents involved in the call, including both those who answered and those who did not.
    ⚠️if the queue strategy is “ring all”, the agent list will include all the agents where the phone rang
    Type: Array of Strings
    Example: "agent_list": [ "Agent Name A", "Agent Name B" ]
     
  16. agent_list_answer
    Description: List of agents who answered the call.
    Type: Array of Strings
    Example: "agent_list_answer": [ "Agent Name A" ]
     
  17. agent_list_no_answer
    Description: List of agents to whom the call was offered but who did not answer.
    Type: Array of Strings
    Example: "agent_list_no_answer": [ "Agent Name B" ] 
    ⚠️if the queue strategy is “ring all”, the agent_list_no_answer will include all the agents that didn’t answered the phone call. 
     
  18. queue_list
    Description: A list of all the queues that the call passed through.
    Type: Array of Strings
    Example:
    "queue_list": [ "Queue Name A", "Queue Name B" ]
     
  19. ivr_list
    Description: A list of all the IVRs (Interactive Voice Response systems) that the call passed through.
    Type: Array of Strings
    Example:
    "ivr_list": [ "ivr_name1", "ivr_name2" ]
     
  20. duration
    Description: To avoid having to do all the mathematics, we provide all the total durations together so you can take the data cooked for you . 

    Fields

    queue: Time spent in the first and last queue, and total queue time.
    a. first: Time spent in the first queue.
    b. last: Time spent in the last queue.
    c. total: Total time spent in queues.

    ring: Time spent ringing the first and last agent, and total ring time.
    d. first: Time spent ringing the first agent.
    e. last: Time spent ringing the last agent.
    f. total: Total time spent ringing.

    ⚠️In case that queue_first.strategy is “ring all”, the duration of the ring will be the summary of all the rings to all agents where the call rang. 

    To know the exact number of ring for one agent, you need to apply this formula: 
    ring / (offered_and_answered + offered_and_not_answered)

    ⚠️ In case there is a transfer, ring “last” will be the transfer ring time

    talk: Time spent talking to the first and last agent, and total talk time.
    g. first: Time spent talking to the first agent.
    h. last: Time spent talking to the last agent.
    i. total: Total talk time.

    ⚠️ In case there is a transfer, the talk “last” will be the transfer talk time

    ⚠️ In case there is a on hook, the talk will be the outgoing call from the agent to the customer

    total: Total call duration.
    wait_time: Time the customer spent waiting in total (ring + queue)
    hold: Time spent on hold during the call.


Type: Object

Example:  
"duration": {
   "queue": {
     "first": 10,
     "last": 10,
     "total": 20
   },
   "ring": {
     "first": 10,
     "last": 10,
     "total": 20
   },
   "talk": {
     "first": 10,
     "last": 10,
     "total": 20
   },
   "total": 45
   "wait_time": 26,
   "hold": 5
 },

  1. ivr_first
    Description: Represents the first IVR  system the call interacted with.
    Fields:
        •    id: The ID of the IVR.
        •    name: The name of the IVR.
        •    phone: The phone number of the IVR.
        •    timestamp: The timestamp in milliseconds when the interaction occurred.
            Type: Object
            Example:
    “ivr_first”: {
    “id”: 9999,
    “name”: “ivr_name1”,
    “phone”: “004599999999”,
    “timestamp”: 1699758055455
    }
     
  2. ivr_last
    Description: Represents the last IVR with which the call interacted.
    Fields:
        •    id: The ID of the IVR.
        •    name: The name of the IVR.
        •    phone: The phone number of the IVR.
        •    timestamp: The timestamp when the interaction with the last IVR occurred.
               Type: Object
               Example:
    “ivr_last”: {
    “id”: 9998,
    “name”: “ivr_name2”,
    “phone”: “004599999998”,
    “timestamp”: 1699758055555
    }
     
  3. queue_first
        Description: Represents the first queue the call entered.
        Fields:
        •    id: The ID of the queue.
        •    name: The name of the queue.
        •    phone: The phone number of the queue.
        •    strategy: The strategy used to assign the call (e.g., rrmemory).
        •    timestart: The timestamp in milliseconds when the call entered the queue.
        •    fail_reason: The reason the call left the queue (e.g., queue_leave_abandon).
        reasons values:queue_leave_digit / queue_leave_empty / queue_leave_timeout / queue_leave_abandon / queue_pick / queue_leave_full
    Type: Object
        Example:
    “queue_first”: {
    “id”: 6667,
    “name”: “Queue Name A”,
    “phone”: “004599999997”,
    “strategy”: “rrmemory”,
    “timestart”: 1699758055916,
    “fail_reason”: “queue_leave_abandon”
    }
     
  4. queue_last
        Description: Represents the last queue the call entered.
       Fields:
        •    id: The ID of the queue.
        •    name: The name of the last queue.
        •    phone: The phone number of the queue.
        •    strategy: The strategy used to assign the call (e.g., rrmemory).
        •    timestart: The timestamp in milliseconds when the call entered the queue.
        •    fail_reason: The reason the call left the queue (e.g., queue_leave_abandon).
        reasons values:queue_leave_digit / queue_leave_empty / queue_leave_timeout / queue_leave_abandon / queue_pick / queue_leave_full
        Type: Object
        Example:
    “queue_last”: {
    “id”: 6666,
    “name”: “Queue Name B”,
    “phone”: “004599999996”,
    “strategy”: “rrmemory”,
    “timestart”: 1699758055916,
    “fail_reason”: “queue_leave_abandon”
    }
     
  5. agent_first
    Description: Represents the first agent who handled the call.
    Fields:
        •    id: The unique identifier of the agent.
        •    name: The name of the first agent involved.
        •    phone: The phone number of the agent.
        •    answered: The timestamp (in milliseconds) when the agent answered the call.
    Type: Object
    Example:
    "agent_first": {
     "id": 5555,
     "name": "Agent Name A",
     "phone": "004599999993",
     "answered": 1699758071921
    }
     
  6. agent_last
    Description: Represents the last agent who handled the call.
    Fields:
        •    id: The unique identifier of the last agent.
        •    name: The name of the last agent involved.
        •    phone: The phone number of the agent.
        •    answered: The timestamp when the agent answered the call.
    Type: Object
    Example:
    "agent_last": {
     "id": 6666,
     "name": "Agent Name B",
     "phone": "004599999992",
     "answered": 1699758071921,
    }
     
  7. redirected
    Description: Provides details about how many times and for what reasons the call was redirected.
    Fields:
        •    total: redirections that occurred during the call.
        •    no_reason: redirections with no specific reason provided.
        •    no_answer:redirections because the recipient didn’t answer.
        •    no_reachable: redirections because the recipient was unreachable.
        •    user_busy: redirections because the recipient was busy.
        •    unconditional: unconditional redirections .
    Type: Object
    Example:
    "redirected": {
     "total": 5,
     "no_reason": 1,
     "no_answer": 1,
     "no_reachable": 1,
     "user_busy": 1,
     "unconditional": 1
    }
     
  8. transfer_first
    Description: Provides information about the first transfer that occurred during the call.
    Fields:
        •    type: The type of transfer (e.g., “blind”).
        •    answered: Indicates if the transfer was answered (1 for yes, 0 for no).
    Type: Object
    Example:
    "transfer_first": {
     "type": "blind",
     "answered": 1
    }