Text call detail records (CDR) can be used on the ProSBC, TMG800, TMG3200 or TMG7800. The Call Detail Records are saved in a log file on a local disk. An entry is made for each call leg, at the start of a call and at the end of the call. In addition, the system can be configured to update the CDRs periodically.
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}
In order to save disk space and simplify the archiving and backup of CDR log files, this log file is automatically archived (gzipped) and rotated every N seconds, as specified by the system configuration.
Variables used for identifying call (or call leg) in general
@{StatusType}: Indicates the type of record ("Start", "Update" or "End").
@{LegId}: Unique Id for this leg (32 bits value).
@{OtherLegId}: Id of the other call leg joined with current call leg.
@{SessionId}: Unique call identifier for two joined and answered call legs, including failed outgoing call attempts (route retry)
Formatted as 4 values of 32 bits, printed as 4 blocks of 8 hexadecimal characters separated by a space
Ex: a939d169 299ffcd0 00000000 00000000
Note: Call Transfer Target legs have a separate SessionId. If you need an Id to correlate a transferred call
to the original call, use @{OriginalSessionId}.
Note: Toolpack 2.9 and above support globally unique SessionId (unique across separate TMedia systems)
@{OriginalSessionId}: Refers to @{SessionId} of the original legs for this call, in case of a call transfer.
In fact, Transfer Target leg has a different value for @{SessionId}, but can be linked with the original call
legs through @{OriginalSessionId}.
@{LinkId}: Same meaning as @{OriginalSessionId}, but presented as a 32 bit integer value.
For all Ids above, please see Known Limitations below for notes about the uniqueness of these values.
Timestamps
@{AlertTime}: Time when the call has started ringing.
@{AlertTime:format}: Same as @{AlertTime} but with custom print format (local time zone), using 'strftime' style, with added
support for @m replaced by milliseconds.
Example format: %Y-%m-%d %H:%M:%S.@m -> 2009-09-02 12:16:24.333
@{ConnectedTime}: Time when the call was answered (and connected with another leg) (in number of seconds since epoch)
@{ConnectedTime:format}: Same as @{ConnectedTime} but with custom print format (local time zone), using 'strftime' style, with added
support for @m replaced by milliseconds.
Example format: %Y-%m-%d %H:%M:%S.@m -> 2009-09-02 12:16:24.333
@{ConnectedTimeUtc:format}:Same as @{ConnectedTime:format} but printed in UTC time, rather than local time zone.
@{CallDuration}: Call duration in seconds (not available in the "start" CDR log)
@{CallDurationMs}: Call duration in milliseconds (end - connected time) (not available in the "start" CDR log)
@{EndTime}: Time when the call started terminating (in number of seconds since epoch).
Note: This slightly differs from the @{Timestamp}, since the 'End' CDR trace is printed once the call
finished terminating,
while @{EndTime} reports the time when the call started terminating (upon hangup for example).
@{EndTime:format}: Same as @{EndTime} but with custom print format (local time zone), using 'strftime' style, with added
support for @m replaced by milliseconds.
Example format: %Y-%m-%d %H:%M:%S.@m -> 2009-09-02 12:16:24.333
@{EndTimeUtc:format}: Same as @{EndTime:format} but printed in UTC time, rather than local time zone.
@{RingingDuration}: Ringing duration in seconds (connected - start time)
@{RingingDurationMs}: Ringing duration in milliseconds (connected - start time)
@{StartTime}: Time when the call was created (in number of seconds since epoch)
@{StartTime:format}: Same as @{StartTime} but with custom print format (local time zone), using 'strftime' style, with added
support for @m replaced by milliseconds.
Example format: %Y-%m-%d %H:%M:%S.@m -> 2009-09-02 12:16:24.333
@{StartTimeUtc:format}: Same as @{StartTime:format} but printed in UTC time, rather than local time zone.
@{Timestamp}: Time when this CDR log entry was written.
Should not be used for billing purposes. Use @{EndTime} for billing @{EndTime} reports the time where
the call has started terminating (hangup), while @{Timestamp} the time where signaling confirmed the termination.
@{Timestamp:format}: Same as @{Timestamp} but with custom print format (local time zone), using 'strftime' style, with added
support for @m replaced by milliseconds.
Example format: %Y-%m-%d %H:%M:%S.@m -> 2009-09-02 12:16:24.333
@{TimestampUtc:format}: Same as @{Timestamp:format} but printed in UTC time, rather than local time zone.
Information related to signaling
@{CalledNumber}: Called number
@{CallingNumber}: Calling number
@{CallingPresentation}: Calling presentation: "Unspecified", "NotAvailable", "Allowed", "Restricted", "AddressRestricted" or "NameRestricted"
@{CallingSubscriberNumber}: Second calling number (ISDN), Generic number of type "additional calling party number" (SS7) and SIP P-asserted-identity, userinfo
@{CallType}: Call type ("Telephony" or "VOIP")
@{IncomingNAP}: Name of the NAP that originated this call (incoming call leg's NAP name).
@{NAP}: Name of the NAP this call leg is from
@{OriginatorName}: Direction of the call:
- "answer" (incoming call leg) - "originate" (outgoing call leg)
Note: In release 2.6 and earlier, the direction of the call is as follows:
- "originate" (incoming call leg) - "answer" (outgoing call leg)
In release 2.7+, the CDR option "Reverse CDR call origin" in Gateway configuration provides the same values as release 2.6.
@{OriginalCalledNumber}: Original called number
@{Protocol}: Type of protocol used ("SS7", "ISDN", or "SIP")
@{RedirectingNumber}: Redirecting number
@{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 a string value
@{OriginalCause}: Original cause of the call termination (before it was converted to protocol-specific cause for current call leg), printed as a string value (refering enum TBCMC_CALL_REASON_CODE)
@{TerminationSource}: Identifies the cause of the leg termination:
- "TermInd": Terminating indication has been received on this leg
- "JoinedTermInd": Terminating indication has been received on the leg joined to current leg,
and has been forwarded to current leg
- "App": Call control application has asked to drop the call
- "Engine": Toolpack engine has decided to terminate this call
(generally due to local errors like disconnected TMedia)
@{UserName}: Static value: 100.
@{SipCallId}: Content of the "call-id" SIP header
@{ChargeIndicator}: For TDM (SS7 and CAS R2); received charge indicator in Alert message.
@{LocalSipIP}: For SIP calls, IP address locally used for this call leg.
Note: Supported in release 3.0.70 and up only.
@{LocalSipPort}: For SIP calls, UDP port locally used for this call leg.
Note: Supported in release 3.0.70 and up only.
@{RemoteSipIP}: For SIP calls, IP address of the remote peer for this call leg.
Note: Supported in release 3.0.70 and up only.
@{RemoteSipPort}: For SIP calls, UDP port of the remote peer for this call leg.
Note: Supported in release 3.0.70 and up only.
Information related to media
@{Codec}: Codec used for this call ("G711" for example)
@{LocalMediaInfo}: Protocol type dependent information on the call leg (local information for SIP calls).
For TDM (Telephony) calls (SS7 or ISDN): "trunk_name:timeslot_nb".
For VOIP calls (SIP): "codec@ip:port" (IP and Port locally used for receiving RTP)
@{LocalMediaIP}: For VOIP calls, RTP IP address locally used for this call leg.
@{LocalMediaPort}: For VOIP calls, RTP UDP port locally used for this call leg.
@{RemoteMediaInfo}: Protocol type dependent information on the call leg (remote information SIP calls).
For TDM (Telephony) calls (SS7 or ISDN): "trunk_name:timeslot_nb".
For VOIP calls (SIP): "codec@ip:port" (IP and Port TMedia is sending RTP to)
@{RemoteMediaIP}: For VOIP calls, RTP IP address of the remote peer for this call leg.
@{RemoteMediaPort}: For VOIP calls, RTP UDP port of the remote peer for this call leg.
@{TimeslotNumber}: For TDM (Telephony) calls, timeslot number that this call was using for audio.
@{TrunkName}: For TDM (Telephony) calls, name of the trunk that this call was using for audio.
Statistics
The call statistics variable enables the printing of RTP, RTCP and T38 statistics in the text CDR logs.
@{ApplicationName}: Name of the application that has written this log ("Gateway")
@{RouteAttribute:attr}: Replaced by the value of a custom route attribute, for the selected
route. This will apply only to outgoing call legs that were made from routing.
Eligible route attributes are:
Route name: Use attribute "route_name". Ex: @{RouteAttribute:route_name}
Route set name: Use attribute "routeset_name". Ex: @{RouteAttribute:routeset_name}
Custom route attribute column: Use the custom attribute name. Ex: @{RouteAttribute:priority}
Routing script parameters: Use the route attribute name provided by routing script.
Ex: If script provides: route[:my_param]="myval"
Then it's included in CDR with @{RouteAttribute:my_param}]
***** Important note: This parameter cannot be retrieved after a switchover of the active to
the standby Toolpack host.
It is recommended to insert this information in the "Start" CDR entry,
rather than in the "End" CDR entry.
@{ScriptAttribute:attr}: Replaced by the value of a routing script attribute stored in params[:bridge].
This applies for incoming and outgoing call legs.
Eligible script attributes are:
Custom CDR value: Use attribute "CustomCdrValue". Ex: @{ScriptAttribute:CustomCdrValue}
Script parameters: Use the attribute name provided by routing script.
Ex: If script provides: params[:bridge][:my_param]="myval"
Then it's included in CDR with @{ScriptAttribute:my_param}
***** Important note: This parameter cannot be retrieved after a switchover of the active to
the standby Toolpack host.
It is recommended to insert this information in the "Start" CDR entry,
rather than in the "End" CDR entry.
Deprecated values:
@{MediaInfo}: Same as @{RemoteMediaInfo}
@{RemoteIP}: Same as @{RemoteMediaIP}
@{RemotePort}: Same as @{RemoteMediaPort}
In a ProSBC 1+1 configuration, only the active server writes the CDR logs. Since the active server may change over time, CDR parsing must take into account that CDR logs may be found in files from the two servers.
The analysis of the logs for the purpose of extracting billing information must be done after combining the two logs, from both servers, sorting the entries by timestamp for example.
CDR entry loss due to switchover
In some situations (during HA switchover for example), some CDR entries may be lost.
Incoherent CDR during switchover
It is worth noting that some CDR records can be lost during transition from active to standby following a system fault. Consequently, a CDR analysis script must handle few "corner" cases:
A "Start" CDR entry without corresponding "End" entry
This happens if a call was terminated during the switchover period.
==> In that case, billing the call is not possible, the "End" CDR information was lost.
A "End" CDR entry without corresponding "Start" entry
This happens if a call was answered just before the HA switchover occurred, and the CDR entry was not yet flushed to disk.
==> In that case, billing can still be done using the "End" entry's "end time" versus "connected time" (unless connected time is 0, meaning the call was never answered)
A call with two "End" CDR entries
This case may happen after some partial HA switchover of the Toolpack system:
The CDR generating application (Gateway) remains alive, but looses it's connection with toolpack_engine
After a timeout, it destroys it's call contexts, and thus writes CDR "End" entries.
Later, connection with toolpack_engine is re-established, and some calls were still valid and connected
The Gateway application re-synchronizes with these calls. These call continue normally until they're hung-up
When hung-up, another "End" CDR entry is written
==> In that case, billing can be done by using the "end time" of the second CDR entry, minus the "connected time" of the first CDR entry.
Retrieving Text CDRs
There are 2 ways to retrieve the text CDR manually or automatically. The procedures are described in Retrieve Text CDR.