How to Get CDR Data from MyPBX U series in Real Time

MyPBX Station Message Detail Recording (SMDR) provides a record of the system’s calls, including outgoing calls, incoming calls and internal calls. Typically, the record outputs to a customer-provided terminal or SMDR data collection device. SMDR allows you to monitor the usage at each extension and trunks. This makes charge-back and traffic managements easier.
The SMDR call record outputs when the call completes. SMDR requires a customer-provided data collection device connected to the MyPBX’s port 5038 through TCP/IP. Below steps will guide you how to activate the SMDR and collect CDR data from MyPBX.

Step 1, Enable AMI on MyPBX and setup the permitted host/IP to access AMI
MyPBX web GUI –> System -> System Preferences -> AMI settings

Figure 1 AMI settings

Remember to save and apply changes on MyPBX web GUI.
Step 2, Connect to MyPBX AMI through TCP/IP.
Here we will use a third party software tool putty.exe to demonstrate how to connect to MyPBX AMI through TCP/IP. A customer-provided data collection device will need to connect to MyPBX within the application and collect the CDR data, stored into its own database and use the CDR data for further purpose.

Figure 2 Access to AMI


Figure 3 Login SMDR

There is a space between ‘action:’ and ‘Login’. Use single CR/LF to change to another line. Use double CR/LF to send and execute the command.

Step3, collect CDR data.
Once login successfully, MyPBX will send quite a lot messages to the application. Please ignore those messages that are not related to CDR. The CDR event will be sent when a call finish. The CDR data will in below format:

Figure 4 CDR event

Event: Cdr
Privilege: cdr,all
Source: 304
Destination: 640
DestinationContext: DLPN_DialPlan304
CallerID: "Normal23" <304>
Channel: SIP/304-00000000
LastApplication: MeetMe
LastData: 640,Ms
StartTime: 2013-08-23 02:36:53
AnswerTime: 2013-08-23 02:36:53
EndTime: 2013-08-23 02:37:08
Duration: 15
BillableSeconds: 15
Disposition: ANSWERED
UniqueID: 1377221813.0
As MyPBX use MySQL as the database to store the CDR data, another much easier way to get the CDR data from MyPBX is access to MyPBX CDR Database directly. See below for detail steps:
Step 1, Setup Database grant on MyPBX web GUI.
Database Grant settings can be found on System -> System Preferences -> Database Grant. We can specify the username and password as we want.

Figure 5 Add a database user

Step 2, Access the Database on MyPBX from external application. Here we use Navicat (A MySQL client) to access to MyPBX CDR Database. If you would like to get CDR data from your application, you will need to customize your application to access to MyPBX database.


Figure 6 New connection

After connect successfully, you will be able to see below CDR table.

Figure 7 CDR table



Have more questions? Submit a request


Please sign in to leave a comment.