Exporting Call Detail Records

Content

CDR Data Export is an API scripting feature that enables you to extract CDR (Call Detail Record) data generated by your ShoreTel Connect CLOUD phone system. This scripting feature enhances your’ ability to obtain and use CDR data for all users on your account. Currently, the ShoreTel Connect portal provides a Usage Log report that provides CDR data for all users. However, the Usage Log report requires manual effort to export CDR data.

NOTE: Call activity is not tracked and call detail records are not recorded for users who have the Call History Privacy feature enabled. For more information about this feature, see Configuring Call History Privacy.

When using CDR Data Export, an HTTP request (customized URL) retrieves an export of CDR data directly from the ShoreTel CDR database. The HTTP request is scripted with specific parameters to extract CDR data to a standard .csv file. The CDR Data Export API can be used by a client-side application to automate the extraction of CDR data on a one-time or recurring basis.

Requirements

Limitations

The following limitations are associated with the CDR Data Export API:

NOTE: CDR data does not change after it is written to the ShoreTel CDR database. For this reason, there is no benefit to downloading the same data more than once. Multiple exports of the same data may cause you to exceed the maximum number of requests.

Generating a CDR Data Report

You can use a web browser or a client-side application to submit a CDR Data Export request URL. This section describes how to format the URL.

NOTE: CDR data for the prior day is available daily by 12PM EST.

Authentication Options

Authentication is performed by transmitting the userid= and pass= parameters in the initial HTTP request headers via HTTP POST.

Parameters for a CDR Data Export Request

Two parameters are required when submitting a CDR Data Export request. Some additional, optional, parameters are also available.

Required Parameters

The following table lists the two parameters that are required when submitting a CDR Data Export request.

Parameter Syntax

Description

startDate=

The start date for the CDR report.

The format is YYYY-MM-DD

endDate=

The end date for the CDR report.

The format is YYYY-MM-DD

NOTE: The maximum date range supported for CDR export is 1 week (7 days). Exporting data for a longer time interval is not supported and may result in a "timing-out" of resources.

Optional Parameters

The following table lists the optional parameters that can be included when submitting a CDR Data Export request.

Parameter Syntax

Description

lastId=

Designed specifically for customers who submit multiple requests per day and who want to avoid receiving a subset of the same (overlapping) data in multiple output files.

To find the ID value to use, sort the most recent CDR export file on the ID column. Use the highest ID value as the lastID parameter when submitting the next CDR Data Export request. This results in a CDR export file containing only CDRs with an ID higher than the value used for the lastId parameter, preventing duplicate (overlapping) information in the CDR export files.

NOTE: Use of the lastId parameter is limited to requesting CDR data for the current and previous date. When a value is supplied for the lastId parameter, the CDR Data Export process ignores the values entered for the required startDate and endDate parameters.

subscribers=

Used to extract CDR data for specified phone numbers only. Any 10-digit phone number that belongs to your ShoreTel Connect CLOUD account can be specified. Multiple numbers can be specified using a comma-separated list.

The format is 9871234567; do not include spaces or special characters.

NOTE: If no value is specified for this parameter, the CDR export file contains CDR data for all phone numbers on the account.

connected=

Used to restrict exported CDR data so that only live calls or non-live calls are included in the export file.

The parameter must be one of the following:

  • yes - to export CDR data for live calls only
  • no - to export CDR data for non-live calls only
  • all - to export CDR data for all calls

NOTE: If no value is specified for this parameter, the CDR export file contains CDR data for live calls only.

accountId=

Used to obtain CDR data for an account other than the account to which the authenticating user belongs. This requires proper permissions set on the server side.

NOTE: If no value is specified for this parameter, the CDR export file contains CDR data for the account of the authenticating user.

direction=

Used to restrict exported CDR data so that only calls of a certain direction are included in the export file.

The parameter must be one of the following:

  • inbound - to export CDR data for inbound calls only
  • outbound - to export CDR data for outbound calls only
  • forward - to export CDR data for forwarded calls only

NOTE: If no value is specified for this parameter, the CDR export file contains CDR data for all calls.

Viewing the CDR Data Export File

The following table describes the data provided in the CDR Data Export (.csv) file.
NOTE: When viewing the data in this file, if any column displays the data as a formula, for example, "#NAME?" instead of the actual data value, see Converting Formulas to Viewable Data in CSV Files for helpful instructions.

Field

Description

Location

Customer account location.

Date

Date when the call was initiated (in mm/dd/yyyy format).

Time

Time when the call was initiated (in hh:mm:ss 24-hour format).

TN Originating

Telephone number of the profile placing the call (in 1NPANXXxxxx format).

Direction

Indicates the direction of the call.

  • INBOUND - indicates that the subscriber received the call
  • OUTBOUND - indicates that the subscriber initiated the call
  • INTERNAL - indicates that the call was between two users within the same ShoreTel Connect CLOUD phone system
  • FORWARD - indicates that the call was transferred

Originating City

City where the call was initiated. For US and Canadian locations, the name of the city is listed in upper-case text. For other international locations, the country is abbreviation listed. For toll-free calls, this field is left blank.

Originating State

State where the call was initiated. For US and Canadian locations, the two-letter abbreviation for the state or province is listed. For other international locations, the country is listed. For toll-free calls, this field is left blank.

TN Dialed

The phone number dialed to place the call.

Destination City

City where the call was received. For US and Canadian locations, the name of the city is listed in upper-case text. For other international locations, the country is listed. For toll-free calls, this field is left blank.

Destination State

State where the call was received. For US and Canadian locations, the two-letter abbreviation for the state or province is listed. For other international locations, the country abbreviation is listed. For toll-free calls, this field is left blank.

Internal

Indicates whether the call was internal (between two users on the same ShoreTel Connect CLOUD phone system) or external.

  • Yes - indicates an internal call
  • No - indicates an external call

Call Type

Indicates the type of call.

  • DOMESTIC
  • INTERNATIONAL
  • TOLLFREE

Duration Minutes

Length of the call in minutes (rounded to two decimal places).

Charge

Cost associated with the call. Charges are normally only incurred for calls that are not included with the associated phone profile type, such as international calls and 900 numbers. Additionally, an account my have some non-billable profile numbers that can incur usage fees. For more information, see XREF.

Account Code

Account code associated with the call (if applicable). For more information about account codes, see XREF.

Answered By Target

Indicates whether or not the call was initially answered by the dialed phone number.

  • Yes - indicates the call was initially answered by the dialed (target) phone number, even if the call was subsequently forwarded to another phone number.
  • No - indicates the call was initially answered by a phone number other than the dialed (target) phone number.

The phone number that initially answered the call is normally associated with an Auto Attendant, Hunt Group, Shared Line Appearance, or other system component.

Id

A unique integer value that is incremented as new rows of CDR data are added to the CDR database for a specific customer account. This Id value is for setting the lastId parameter when submitting a CDR Data Export request. See the Optional Parameters for more information.

Example CDR Data Export Requests

This section contains example CDR Data Export request URLs and Wget code.

Example URLs

The following is an example of a URL with only the two required parameters:

https://portal.shoretelsky.com/DataExport/CDRData?startDate=2015-02-01&endDate=2015-02-15

The following is an example of a URL with the two required parameters and the optional lastId parameter:

https://portal.shoretelsky.com/DataExport/CDRData?startDate=2015-06-20&endDate=2015-06-21&lastId=12345678910

Example Wget Code

The following is an example of Wget code used to submit a URL with required and optional parameters:

$ wget --user=user@shoretel.com --password=pass "https://portal.shoretelsky.com/DataExport/CDRData?startDate=2015-02-01&endDate=2015-02-15&direction=inbound&connected=true&subscribers=6464425780,6464421610"

The Wget code above results in the following response:

HTTP request sent, awaiting response... 401 Unauthorized

Connecting to portal.shoretelsky.com ... connected.

HTTP request sent, awaiting response... 200 OK

Length: 1389 (1.4K) [text/csv]

Saving to: `CDRData@startDate=2014-02-01&endDate=2014-02-15&direction=inbound&connected=true&subscribers=6464425780,6464421610'

100%[====================================================================================================================>] 1,389 --.-K/s in 0s

2015-04-01 12:10:25 (11.6 MB/s) - `CDRData@startDate=2014-02-01&endDate=2014-02-05&direction=inbound&connected=true&subscribers=6464425780,6464421610' saved [1389/1389]

Related Articles

Managing Invoices and Payments
Viewing Invoice Group Information
Viewing Services Data
Viewing the Usage Log
Viewing Courtesy Usage Reports
Viewing Fax Usage Reports
ShoreTel Connect Portal Documentation

ShoreTel Dates

Created Date 2016-08-12 - Modified Date 2017-07-31


Article: 000012075