Configuring Text CDR in SmartMedia + Text CDR Variables
Posted by Joshua Puckett, Last modified by Danny Staub on 15 November 2017 02:56 PM

Call Detail Records (CDR) are very intricate in the SmartMedia Platform, allowing the user to configure the output to achieve exactly what is needed.

 

To enable CDRs please navigate to 'Menu -> Gateway -> Edit Configuration -> CDR Options' and check the box below:

 

Once this is marked CDR Options will reveal. In order to customize your CDR Output please expand "Text CDR parameters" field

CDR Format boxes will become available for filling in.

Each box represents one of 3 possible CDR states:

  • Start
  • Update
  • End

and is populated with CDR field names with receive their values from system Channel Variables. Each pair should be created from:

Name='@{VariableString}' 

For a full list of Variables please see below.

Exmplary CDR format configuration:

CDR format config

 

Each CDR state begins with Timestamp value and keyword representing the state. Below you can find two examples of single call CDR:

 SIP -> ISDN

2015-05-12 18:20:37.410+0200,BEG,SessionId='a1ef6a38 00000000 00000000 00000000',LegId='0xA1EF6A38',StartTime='1431447634',ConnectedTime='1431447637',Calling='1000',Called='6001',NAP='NAP_SIP_FS5062',Protocol='SIP',Direction='originate'
2015-05-12 18:20:37.410+0200,BEG,SessionId='a1ef6a38 00000000 00000000 00000000',LegId='0x21EF9549',StartTime='1431447634',ConnectedTime='1431447637',Calling='1000',Called='116001',NAP='NAP_ISDN_SN4950E1_0',Protocol='ISDN',Direction='answer'
2015-05-12 18:20:41.694+0200,END,SessionId='a1ef6a38 00000000 00000000 00000000',LegId='0xA1EF6A38',StartTime='1431447634',ConnectedTime='1431447637',EndTime='1431447641',FreedTime='1431447641',TerminationCause='NORMAL',TerminationSource='TermInd',Calling='1000',Called='6001',NAP='NAP_SIP_FS5062',Direction='originate'
2015-05-12 18:20:41.796+0200,END,SessionId='a1ef6a38 00000000 00000000 00000000',LegId='0x21EF9549',StartTime='1431447634',ConnectedTime='1431447637',EndTime='1431447641',FreedTime='1431447641',TerminationCause='NORMAL_CALL_CLEARING',TerminationSource='JoinedTermInd',Calling='1000',Called='116001',NAP='NAP_ISDN_SN4950E1_0',Direction='answer'

 

ISDN -> SIP

2015-05-12 18:23:11.498+0200,BEG,SessionId='a1ef6a39 00000000 00000000 00000000',LegId='0xA1EF6A39',StartTime='1431447788',ConnectedTime='1431447791',Calling='1000',Called='216001',NAP='NAP_ISDN_SN4950E1_0',Protocol='ISDN',Direction='originate'
2015-05-12 18:23:11.499+0200,BEG,SessionId='a1ef6a39 00000000 00000000 00000000',LegId='0x21EF954A',StartTime='1431447788',ConnectedTime='1431447791',Calling='1000',Called='6001',NAP='NAP_SIP_FS5062',Protocol='SIP',Direction='answer'
2015-05-12 18:23:29.043+0200,END,SessionId='a1ef6a39 00000000 00000000 00000000',LegId='0xA1EF6A39',StartTime='1431447788',ConnectedTime='1431447791',EndTime='1431447808',FreedTime='1431447809',TerminationCause='NORMAL_CALL_CLEARING',TerminationSource='TermInd',Calling='1000',Called='216001',NAP='NAP_ISDN_SN4950E1_0',Direction='originate'
2015-05-12 18:23:29.044+0200,END,SessionId='a1ef6a39 00000000 00000000 00000000',LegId='0x21EF954A',StartTime='1431447788',ConnectedTime='1431447791',EndTime='1431447808',FreedTime='1431447809',TerminationCause='NORMAL_CALL_CLEARING',TerminationSource='JoinedTermInd',Calling='1000',Called='6001',NAP='NAP_SIP_FS5062',Direction='answer'

 


The following variables can be used to define the CDR log format.


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, but may eventually be upgraded to 64 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 separate SessionId. If you need an id to correlate a transferred call
                                 to the original call, use @{OriginalSessionId}.
@{OriginalSessionId}:      Refers to @{SessionId} of the original legs for this call, in case of 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 bits integer value.





Timestamps:

@{AlertTime}:              Time where the call has started ringing.
                           Note: Supported on release 2.7 and up only.
@{ConnectedTime}:          Time where 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)
                           Note: Supported on release 2.7 and up only.
@{CallDurationMs}:         Call duration in milliseconds (end - connected time) (not available in the "start" CDR log)
                           Note: Supported on release 2.7 and up only.
@{EndTime}:                Time where the call has started terminating (in number of seconds since epoch).
                           Note that slightly differs from the @{Timestamp}, since the 'End' CDR trace is printed once the call has
                           finished terminating,
                           while @{EndTime} reports the time where the call has 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)
                           Note: Supported on release 2.7 and up only.
@{RingingDurationMs}:      Ringing duration in milliseconds (connected - start time)
                           Note: Supported on release 2.7 and up only.
@{StartTime}:              Time where 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 where 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"
                           Note: Supported on release 2.7 and up only.
@{CallingSubscriberNumber}: Second calling number (ISDN) or Generic number of type "additional calling party number" (SS7) 
                           Note: Supported on release 2.7.43 and up only.
@{CallType}:               Call type ("Telephony" or "VOIP")
@{IncomingNAP}:            Name of the NAP that originated this call (incoming call leg's NAP name).
                           Note: Supported on release 2.7 and up only.
@{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 provide the same values as in release 2.6.
@{OriginalCalledNumber}:   Original called number
                           Note: Supported on release 2.7 and up only.
@{Protocol}:               Type of protocol used ("SS7", "ISDN", or "SIP")
@{RedirectingNumber}:      Redirecting number
                           Note: Supported on release 2.7 and up only.
@{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, 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":        SmartMedia engine has decided to terminate this call
                                                (generally due to local errors like disconnected TelcoBoard)
@{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.





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 TelcoBoard 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 following variables allow to print call statistics in the text CDR logs.

There are some restrictions, however:

  • Available only in the "end" CDR entry

  • Available in release 2.7.103 and above only

 

@{Stat:stat_name}:         Get the specified statistic's value. Example: @{Stat:Rtp:Rx:Packets}.
                           Available statistics names:
                           RTP Rx (received IP packets):
                            - Rtp:Rx                             Summary of the Rx stats (Packets;CNPackets;SignalingPackets;Errors)
                            - Rtp:Rx:Packets:                    Number of packets received from the IP network (audio + comfort noise + signaling)
                            - Rtp:Rx:VoicePackets:               Number of voice (audio) packets received from the IP network
                            - Rtp:Rx:VoiceBytes:                 Number of payload bytes from voice (audio) packets received from the IP network
                            - Rtp:Rx:CNPackets:                  Number of comfort noise packets received from the IP network
                            - Rtp:Rx:SignalingPackets:           Number of signaling packets (like "Telephony events") received from the IP network
                            - Rtp:Rx:RFC2833Tones:               Number of RFC2833 tones received from the IP network, and played back to TDM
                            - Rtp:Rx:RedundantPackets:           Number of redundant packets received from the IP network (same sequence number received more than once)
                            - Rtp:Rx:MeanPower:                  Mean audio power (from IP to TDM direction), in dBov (0 the loudest, negative is softer level)
                                                                 (Available only for calls with Echo cancellation enabled, thus only TDM<->IP calls)
                            - Rtp:Rx:VoiceDuration:              Duration (in seconds) of voice (audio), from IP to TDM direction
                            - Rtp:Rx:PlayoutDelay:               Current IP to TDM audio delay in millisecond (adaptive jitter buffer delay) 
                            - Rtp:Rx:MaxPlayoutDelay:            Maximum (for the whole call) IP to TDM audio delay in millisecond (adaptive jitter buffer delay) 
                            - Rtp:Rx:SsrcChanges:                Number of changes of "SSRC" RTP header value (counting initial SSRC received as one)
                            - Rtp:Rx:Concealments:               Number of times decoder made audio concealment to preserve audio continuity
                                                                 (frequent upon first packet of a call, or after RFC2833 tones)
                            - Rtp:Rx:Echo:ERLLevel:              Attenuation of a signal from the received-out port to the send-in port of an echo canceller
                            - Rtp:Rx:Error:BufOverflows:         Number of packets dropped due to jitter buffer adaptation (to keep play-out delay low)
                            - Rtp:Rx:Error:SeqErrors:            Number of sequence errors detected among packets received from the IP network
                            - Rtp:Rx:Error:BadPackets:           Number of packets received with invalid header, or other error preventing proper audio decoding
                            - Rtp:Rx:Error:RFC2833BadPackets:    Number of RFC2833 signaling packets that could not be properly decoded
                            - Rtp:Rx:Error:LatePackets:          Number of packets that arrived after the moment they should have started to be played-out to TDM
                            - Rtp:Rx:Error:LostPackets:          Number of packets considered "lost" (never received for play-out to TDM)
                            - Rtp:Rx:Errors:                     Total of all "Rtp:Rx:Error:" statistics above
                          RTP Tx (sent IP packets):
                            - Rtp:Tx                             Summary of the Tx stats (Packets;CNPackets;SignalingPackets;Errors)
                            - Rtp:Tx:Packets:                    Number of packets sent to the IP network (audio + comfort noise + signaling)
                            - Rtp:Tx:VoicePackets:               Number of voice (audio) packets sent to the IP network
                            - Rtp:Tx:CNPackets:                  Number of comfort noise packets sent to the IP network
                            - Rtp:Tx:SignalingPackets:           Number of signaling packets (like "Telephony events") sent to the IP network
                            - Rtp:Tx:RFC2833Tones:               Number of RFC2833 tones sent to the IP network (relaying corresponding detected TDM tones)
                            - Rtp:Tx:MeanPower:                  Mean audio power (from TDM to IP direction), in dBov (0 the loudest, negative is softer level)
                                                                 (Available only for calls with Echo cancellation enabled, thus only TDM<->IP calls)
                            - Rtp:Tx:VoiceDuration:              Duration (in seconds) of voice (audio), from TDM to IP direction
                            - Rtp:Tx:Echo:ACOMLevel:             Attenuation of a signal from the receive-out port to the send-out port of an echo canceller
                            - Rtp:Tx:Error:LostPackets:          Number of packets considered "lost" by remote side (only available if RTCP is used)
                            - Rtp:Tx:Error:ArpFailure:           Number of failures to ARP remote IP address to send RTP packets to (preventing sending any packets)
                            - Rtp:Tx:Errors:                     Total of all "Rtp:Tx:Error:" statistics above
                          RTCP (only if RTCP is enabled on the profile):
                            - Rtcp                               Summary of the Rtcp stats (Packets;LostPackets;Jitter)
                            - Rtcp:Packets:                      Number of packets reported as received by remote equipment
                            - Rtcp:LostPackets:                  Number of packets reported as lost by remote equipment
                            - Rtcp:Jitter:                       Inter-packet interval jitter, in millisecond
                          T.38 Rx (from IP to TDM direction):
                            - T38:StateChanges:                  Number of T.38 state changes, through T.30 negotiation between FAX machines
                            - T38:Rx                             Summary of the Rx stats (Pages;Packets;Errors)
                            - T38:Rx:Pages:                      Number of FAX pages received from T.38 packets from the IP network
                            - T38:Rx:Packets:                    Number of T.38 packets received from the IP network
                            - T38:Rx:Bytes:                      Number of T.38 payload bytes from T.38 packets received from the IP network
                            - T38:Rx:Duration:                   Duration of the T.38 session from IP to TDM
                            - T38:Rx:PlayoutDelay:               Current IP to TDM audio delay in millisecond (re-modulation and jitter buffer delay) 
                            - T38:Rx:MaxPlayoutDelay:            Maximum IP to TDM audio delay in millisecond (re-modulation and jitter buffer delay) 
                            - T38:Rx:Error:BufOverflows:         Number of packets dropped because "from IP" jitter buffer is full
                            - T38:Rx:Error:BufUnderflows:        Number of times T.38 re-modulation to TDM had no data (received from IP) to re-modulate
                            - T38:Rx:Error:SeqErrors:            Number of sequence errors detected among packets received from the IP network
                            - T38:Rx:Error:BadPackets:           Number of packets received with invalid header, or other error preventing proper audio decoding
                            - T38:Rx:Errors:                     Total of all "T38:Rx:Error:" statistics above
                          T.38 Tx (to IP, from TDM direction):
                            - T38:Tx                             Summary of the Tx stats (Pages;Packets)
                            - T38:Tx:Pages:                      Number of FAX pages received from TDM, sent to T.38 packets to the IP network
                            - T38:Tx:Packets:                    Number of T.38 packets sent to the IP network
                            - T38:Tx:Bytes:                      Number of T.38 payload bytes from T.38 packets sent to the IP network
                            - T38:Tx:Duration:                   Duration of the T.38 session from TDM to IP
                            - T38:FromTdm:MeanPower:             Mean audio power received from TDM side, in dBov (0 the loudest, negative is softer level)





Information related to routing:

@{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 SmartMedia host.
                                                   It's thus recommended to insert this information in the "Start" CDR entry,
                                                   rather than the "End" CDR entry.
@{ScriptAttribute:attr}:   Replaced by the value of a routing script attribute stored in params[:bridge].
                           This will apply 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 SmartMedia host.
                                                   It's thus recommended to insert this information in the "Start" CDR entry,
                                                   rather than the "End" CDR entry.

 




(8748 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).