Skip to content
This repository was archived by the owner on Apr 14, 2025. It is now read-only.

Example | Call Detail Report

Tim S edited this page Jan 13, 2017 · 3 revisions

Configuration files, extensions, and templates can be found in the repo at https://github.com/MyPureCloud/open-data-exporter/tree/master/src/examples/call_detail_report

Table of Contents

Overview

This example illustrates using the results of one request to make additional requests. Specifically, the results from an analytics conversation detail query are used to generate a list of conversations to request individually for the purpose of retrieving participant data that is not available in the analytics data. The configuration adds the participant data to the analytics data, and the output template display the value of the custom participant attribute accountNumber.

Configuration

requests

cdr_request

  • This request is of type conversationDetail, which makes an analytics query for conversation details.
  • This query uses segment filters to match segments with purpose=acd, and mediaType=voice.
  • The strategy is single, but getAllPages is true, so the query is repeated until the analytics resource returns an empty data set to indicate that all results have been retrieved. The results from each request are aggregated into a single data set.
  • The body of the query uses the value from def.vars.previousInterval to dynamically gather data from the previous interval relative to whenever the job is executed.

cdr_conversation_details_request

  • This request is of type getConversation, which makes an API request to get a single conversation
  • The strategy is repeat, so the query will be repeated for each conversation ID in the collection
  • The collection references def.vars.conversationIds, which is generated by a transform.

transforms

cdr_segment_data_transform

This transform invokes addSegmentsToParticipant with the cdr_request data to retrieve ani, dnis, and direction properties from the segment and set them as properties on the participant. The purpose of this is to alter the data structure to make the data easy to access in a template.

cdr_coalesce_conversation_ids_transform

This transform is used to populate def.vars.conversationIds as an array of conversation IDs to be used by cdr_conversation_details_request.

cdr_aggregate_participant_attributes_transform

This transform takes participant attributes from the results of cdr_conversation_details_request and aggregates them into the data from cdr_request.

cdr_ensure_attributes_transform

This transform iterates the conversations and their participants and ensures that the accountNumber participant attribute is initialized to an empty string if no value exists. This prevents undefined from being displayed in the template.

write_data

This transform has a single expression that invokes the dataOperations module's write_data function to write out the data object to a file for debugging purposes.

templates

cdr_template

This template references an external template file and defines a filename with a template that includes the execution date.

exports

cdr_export

This defines where the template output will be stored.

configurations

cdr_config

This configuration:

  • Loads the extension file into def.cdr_request
  • Defines an execution plan to execute cdr_request, cdr_segment_data_transform, cdr_coalesce_conversation_ids_transform, cdr_conversation_details_request, cdr_aggregate_participant_attributes_transform, cdr_ensure_attributes_transform, and then write_data
  • Processes the cdr_template template
  • Exports the template using cdr_export
  • Defines a custom interval of 1 hour (PT1H)

jobs

cdr_job

This job executes the cdr_config configuration.

customData

This configuration has a global custom data property of "company": "Genesys". This makes the company name available via def.vars.company.

Example

img

Clone this wiki locally