Actions

Text Call Detail Records

Revision as of 10:56, 10 September 2009 by Abrassard (talk | contribs) (Created page with '== TEXT CDR (Call Detail Record) == == OVERVIEW == Text CDR (Call Detail Record) are saved in a log file on disk. In order to save disk space and simplify archiving and backup …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

TEXT CDR (Call Detail Record)

OVERVIEW

Text CDR (Call Detail Record) are saved in a log file on disk.

In order to save disk space and simplify archiving and backup of CDR log files, this log file is automatically archived (gzipped) and rotated every N seconds, as specified by configuration.

The format of the CDR traces is defined by configuration, using variables that are replaced by the Gateway application when writing to the log. For example, the following variable will be replaced by the called number: @{CalledNumber}

ENABLING TEXT CDR

Text CDR is enabled through the Toolpack Web Portal:

  • Go to the Gateway->Configuration menu.
  • Click on the Edit link of the configuration you wish to enable CDR for.
  • Click on Use CDR behavior to enable the CDR behavior
  • Expand the CDR Options section
  • Click on Use text CDR to enable text-based CDR
  • Expand the Text CDR parameters section
  • Configure the Text CDR parameters the way you want, using the parameters describe below


CONFIGURATION PARAMETERS

  • CDR log file path: Path of the CDR log file, relative to the current working directory of the Gateway application ([...]/toolpack/setup/2.X/apps/gateway).
  • CDR format (start): Format of the text CDR log written at the time the call is answered. This format contains variables automatically replaced (see below).
  • CDR format (end): Format of the text CDR log written at the time the call is terminated. This format contains variables automatically replaced (see below).
  • Rotation delay in seconds: Delay, in seconds, at which the log file is rotated and gzipped. A delay of 3600 seconds will make log file rotate very hour, for example.
  • Max total size of gzipped CDR logs: Maximum total size (in bytes) of all gzipped log file segments on disk. If ever total size exceeds this limit, older gzipped log files will be deleted.


AVAILABLE VARIABLES

The following variables exist and can be used to define the CDR log format:

*@{ApplicationName}:        Name of the application that has written this log ("Gateway")
*@{CalledNumber}:           Called number
*@{CallingNumber}:          Calling number
*@{CallType}:               Call type ("Telephony" or "VOIP")
*@{Codec}:                  Codec used for this call ("G711" for example)
*@{ConnectedTime}:          Time where the leg was connected with another leg (in number of seconds since epoch)
*@{EndTime}:                Time where the leg was terminated (in number of seconds since epoch)
*@{LegId}:                  Unique Id for this leg (32 bits value, but may eventually be upgraded to 64 bits value).
                             Please note that in current implementation this Id is unique at a given time,
                             but it can be reused later for subsequent calls. This Id will, however, remain constant
                             even if there is a HA switchover between any active and standby components of the system.
*@{LinkId}:                 Unique Id of the link between two call legs (32 bits value, but may eventually be upgraded to 64 bits value).
                            Please note that in current implementation this Id is unique at a given time, but it can be reused later for subsequent calls.
*@{MediaInfo}:              Protocol type dependent information on the call leg.
                            For TDM (Telephony) calls (SS7 or ISDN): "trunk_name:timeslot_nb".
                            For VOIP calls (SIP): "codec@ip:port"
*@{NAP}:                    Name of the NAP this call leg is from
*@{OrginatorName}:          Direction of the call:
                             - "originate" (incoming call leg) - "answer" (outgoing call leg)
*@{Protocol}:               Type of protocol used ("SS7", "ISDN", or "SIP")
*@{RemoteIP}:               For VOIP calls, IP address of the remote peer for this call leg.
*@{RemotePort}:             For VOIP calls, UDP port of the remote peer for this call leg.
*@{SessionId}:              Unique call identifier, in the form of 4 values of 32 bits, printed as 4 blocks of 8 hexadecimal charaters separated by a space.
                             Please note that in current implementation this Id is unique at a given time, but it can be reused later for subsequent calls.
*@{StartTime}:              Time where the leg was answered (in number of seconds since epoch)
*@{TerminationCause}:       Cause of the call termination, printed as an integer value (refering enum TBCMC_CALL_REASON_CODE)
*@{TerminationCauseString}: Cause of the call termination, printed as an string value
*@{TerminationSource}:      Identifies which of the legs has initiated the call termination first: "LocalLeg" or "ConnectedLeg"
*@{TimeslotNumber}:         For TDM (Telephony) calls, timeslot number that this call was using for audio.
*@{Timestamp}:              Timestamp with prevision of about 10 milliseconds, in the following format: "2009-09-02 12:16:24.333"
*@{TrunkName}:              For TDM (Telephony) calls, name of the trunk that this call was using for audio.
*@{UserName}:               For SIP calls, name of the user.


REDUNDANCY

In a redundant Toolpack system with two Gateway applications, the active Gateway application writes the CDR logs.

The analysis of the the logs for extracting billing information must be done after combining the two logs, sorting the entries by timestamp for example. An entry will never be duplicated. It can, however, be lost during transition from active ot standby Gateway application. The CDR analysis script must thus handle the case where a call answered log does not match any call termination log.

  • We don't recommend storing CDR logs through network (NFS or other). We highly recommend writing to a local hard drive, and have a background script that moves the gzipped log segments for backup or analysis.


DEFAULT VALUES

The default values are the following. For the CDR that is printed when the call leg is answered:

@{Timestamp}: SessionId='@{SessionId}' LegId='@{LegId}' StartTime='@{StartTime}' Calling='@{CallingNumber}' Called='@{CalledNumber}' NAP='@{NAP}' Protocol='@{Protocol}' Direction='@{OrginatorName}'


For the CDR that is printed when the call leg is terminated:

@{Timestamp}: SessionId='@{SessionId}' LegId='@{LegId}' EndTime='@{EndTime}' TerminationCause='@{TerminationCauseString}' MediaInfo='@{MediaInfo}'


EXAMPLES

For example, one may define a short coma-separated-value (csv) Cdr log file to minimize disk space:

"@{LegId},@{StartTime},@{EndTime},@{CallingNumber},@{CalledNumber},@{NAP}"

As another example, one may define a XML-based Cdr log file:

<cdr_start>