-
Notifications
You must be signed in to change notification settings - Fork 15
Example | Call Detail Report
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
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
.
- 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
, andmediaType=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.
- 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.
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.
This transform is used to populate def.vars.conversationIds
as an array of conversation IDs to be used by cdr_conversation_details_request
.
This transform takes participant attributes from the results of cdr_conversation_details_request
and aggregates them into the data from cdr_request.
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.
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.
This template references an external template file and defines a filename with a template that includes the execution date.
This defines where the template output will be stored.
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 thenwrite_data
- Processes the
cdr_template
template - Exports the template using
cdr_export
- Defines a custom interval of 1 hour (
PT1H
)
This job executes the cdr_config
configuration.
This configuration has a global custom data property of "company": "Genesys"
. This makes the company name available via def.vars.company
.