This page describes tools for processing binary CDR files delivered as part of the CDR Resource Adaptor package.

Display binary CDR file content

The CDR Resource Adaptor package contains two user tools that can be used to display the content of a binary CDR file in text format.

Tool Description
 listcdrs.py

A Python script that displays the content of a binary CDR file in text format.

Usage:

listcdrs.py CDRFILE
Note This script requires the Python protocol buffers module, which is available as part of a complete protocol buffers installation. (Depending on your operating system type and vendor, it might also be available as part of your standard software distribution system.)
 listcdrs.sh

A shell script that starts a Java program capable of querying and displaying a binary CDR file’s content in text format.

Usage:

listcdrs.sh [--field field --regex regex] [--formatted] CDRFILE [CDRFILE]...
Tip To list possible values for the --field parameter, display the binary CDR file content without the --field parameter. Any text followed by = is a field name.

The --regex parameter takes a regular expression; only CDRs with matching field values display. The supported regular expression format is described in the Pattern class documentation.

The --formatted option results in using a multiline display format.

This tool also supports CDR binary files in gzip format. Each file that ends with a .gz suffix is treated as compressed. That is, there is no need to decompress such CDR files before running the tool.

Note When invoked without parameters, each tool displays a short usage message.

Extendable binary CDR file processing tools

The CDR processing tool cdrpipeline is a Java-based tool that streamlines development of custom binary CDR files' processing logic.

The cdrpipeline is responsible for loading and parsing binary CDR files. The actual CDR processing logic is captured as plugins provided by the service developer, where cdrpipeline plugins are implementations of the CDRProcessor interface.

The tool is delivered with abstract helper implementations of a CdrProcessor that allow the service developer to cede responsibility for decoding the binary CDR (protocol buffer message) to the helper class. The service developer can then concentrate on creating custom processing logic without the need to reimplement the boilerplate message-parsing code. This effectively lets the service developer work with the binary CDR at the same abstraction level (protocol buffer message) when generating the CDR in service code and when post-processing the resulting binary CDR files.

Note
See also
The CDR File Tools API Javadoc.

Running the CDR Pipeline tool

The cdrpipeline tool can be run using the cdrpipeline.sh shell script delivered as part of the CDR resource adaptor package.

Usage:
cdrpipeline.sh [-i] [-p <property=value>] [-s <bytes>] -c <processor> [<processor>]... -f <cdrfile> [<cdrfile>]...

Option

Description

-c <processor> [<processor>]...
--chain <processor> [<processor>]...

Class names representing com.opencloud.slee.resources.cdr.process.CdrProcessor to be used to process CDR records.

Note The CdrProcessor classes are invoked in the order in which they are specified on the command line. The order is relevant as every CDR processor may act as a filter. That is, a CDR processor may instruct the tool that a given CDR is not to be processed by later CDR processors.
 -f <cdrfile> [<cdrfile>]...
--files <cdrfile> [<cdrfile>]...

Binary CDR files to process.

Note The CDR files are processed in the order in which they are specified on the command line.
-i
--ignore-error

If specified, the tool is to ignore record-processing errors and continue processing.

 -p <property=value>
--processor-property <property=value>

Custom property value pair to be used by CDR processors.

-s <bytes>
--size-limit <bytes>

CDR record size limit.

Minimal supported value is 67108864 (64 MB). The default value is equal to minimal value, which is 67108864 (64 MB).

Note The version of protocol buffers library used by the CDR resource adaptor does not enforce the limit uniformly. If processing fails with message "InvalidProtocolBufferException: Protocol message was too large" and you are sure that the CDR file that is processed is correct, increase the limit.

This tool also supports CDR binary files in gzip format. Each file that ends with a .gz suffix is treated as compressed. That is, there is no need to decompress such CDR files before running the tool.

Examples

To process all files in the ../../cdr directory matching *.log.gz using a processor that outputs stats for each file:

./cdrpipeline.sh -c com.opencloud.slee.resources.cdr.process.GenerateStatsCdrProcessor -f ../../cdr/*.log.gz

To process the same files using a processor that outputs formatted content of the CDRs, and increase the size limit for protobuf messages to 128MB:

./cdrpipeline.sh -c com.opencloud.slee.resources.cdr.process.listcdr.FormattedCdrProcessor -s 134217728 -f ../../cdr/*.log.gz

The other processor that can be used for simple (single-line) output is com.opencloud.slee.resources.cdr.process.listcdr.SimpleCdrProcessor.

Developing a custom CDR Processor

To create and use a custom CdrProcessor, you must implement the com.opencloud.slee.resources.cdr.process.CdrProcessor interface (or any of the implementing helper classes), and place the compiled class file (or jar file) in the classpath used by cdrpipeline.

Note Example CdrProcessor implementations are distributed as part of the Example Service.

CDR Pipeline source code

The binary version of the cdrpipeline tool is located in the lib directory of the CDR resource adaptor package. The relevant jar files are described below:

Filename Description Required to compile against?
cdr-file-tools-VERSION.jar

Classes constituting the cdrpipeline tool, including the com.opencloud.slee.resources.cdr.process.CdrProcessor interface.

Yes

cdr-file-format-VERSION.jar

Classes generated by the protocol buffers library, used to decode data from the binary CDR file.

Yes

protobuf-java-VERSION.jar

Protocol buffers Java library, used to decode data from the binary CDR file.

Yes

log4j-VERSION.jar

Log-handling library.

No

commons-cli-VERSION.jar

Command-line parameters-handling library.

No

…​ where VERSION represents the version of the CDR resource adaptor or library used.

The CDR Pipeline classpath

The classpath searched by the cdrpipeline tool when using the provided cdrpipeline.sh script includes:

  • the current working directory

  • jar files in the lib directory of the CDR resource adaptor package

  • directories specified in the OPT_JAR_LIST environment variable (separated using the : character).

Previous page Next page