Placeholder for our stuff related to Telecom, IT, Internet of things (IOT), ESP8266, Raspberry Pi

Home IOT Telecom IT stuff About Us Contact Us Site Map

SIPp: Generate CDR Log

 Jan 25, 2021

To get a csv file of call detail records, you can use log message command. The “log” action allows you to customize your traces. Messages are printed in the <scenario filename>_<pid>_logs.log file. Any keyword is expanded to reflect the value actually used.
Warning: Logs are generated only if -trace_logs option is set on the command line.

Lets start with an example where we want following fields in CDR csv file.
Call Start Time, From, To,  Call ID, Call Duration

Here is the full uac scenario

And let's break it down ...

Call Duration timer starts when sipp receives 200 OK and sends ACK. Following code snippet is taken from above scenario just after sipp sends ACK.

It just puts timestamp and clock_tick in variables. Also clock_tick is converted from string to float as we intend to do subtraction later.

<assignstr assign_to="1" value="[timestamp]" />
<assignstr assign_to="2" value="[clock_tick]" />
<!-- Converts the string value in $2 to a double-precision value stored in $3. -->
<todouble assign_to="3" variable="2" />

Call Duration timer stops when sipp sends BYE and receives 200 OK. Following code snippet is taken from scenario just after sipp receives 200 OK to BYE sent.

Here we store present clock_tick in other variable and subtract previous clock_tick (ACK sent) from it, to get call duration in milli seconds.
Call Duration = clock_tick (BYE) - clock_tick (ACK)

<assignstr assign_to="4" value="[clock_tick]" />
<!-- Converts the string value in $4 to a double-precision value stored in $5. -->
<todouble assign_to="5" variable="4" />
<subtract assign_to="5" variable="3" />
<log message="StartTime is [$1],[last_From],[last_To],CallID is [call_id],CallDuration(ms) is [$5]" />

To demonstrate I have logged Start Time, From, To, Call ID and Duration. You can add more fields, customize and format it.

Note: Apparently <NOP> before <RECV> doesn't work.

To run this scenario I used following commands

./sipp -i -p 2500 -sn uas

./sipp -i -p 2500 -sf uac-cdr.xml -s 901 -d 5000 -m 10 -trace_logs

And below is a cdr files thus generated for 10 calls (1 line for each call, total 10 lines)


Next, how to generate calls of different call-durations.



Suresh Hariramani

I am an IOT enthusiast with more than 20 years of experience in the IT sector. Specializing in telecom service's; follow me for some very innovative and best in class IOT products as I unfold my knowledge and passion for the subject.


Vatsal Hariramani

Just me, myself and I, exploring the universe of uknownment. I have a heart of love and interests in technology, IOT and travel . And I want to share my world with you .