Asterisk (AMI interface) SMDR setup and CDR format
This page shows how to get call records out of the Asterisk (AMI interface) into Advanced PBX Data Logger: the connection settings, the parser to select and the 15 fields the logger extracts for reports or a database. The settings apply to our logger; other call accounting software may expect a different configuration.
Quick facts
| Item | Asterisk (AMI interface) |
|---|---|
| Interface | LAN. The PBX accepts a connection on TCP port 5038; the logger connects to the PBX IP address. |
| Port | 5038 |
| Parser to select | Asterisk (AMI interface) |
| Fields extracted | 15 |
Customized configuration
Introduction
The Asterisk Manager Interface (AMI) is a client/server model over TCP. With the manager interface, you'll be able to control the PBX, originate calls, check mailbox status, monitor channels and queues as well as execute Asterisk commands.
AMI is the standard management interface into your Asterisk server. You configure AMI in manager.conf. By default, AMI is available on TCP port 5038 if you enable it in manager.conf.
Solution
You have to modify/create 'cdr_manager.conf' in the /etc/asterisk/ directory. Then enable CDR over the Manager API you must enable it in cdr_manager.conf:
; ; Asterisk Call Management CDR ; [general] enabled = yes
Once you have saved the file, you have to enter the Asterisk CLI. From the CLI, you will need to reload the cdr_manager.so module. Please do the following:
module reload cdr_manager.so
If you are getting an error that it is not loaded, please load this module:
module load cdr_manager.so
Then, to verify that it is loaded, please type:
cdr show status
You should see something like this:
pbx*CLI> cdr show status Call Detail Record (CDR) settings ---------------------------------- Logging: Enabled Mode: Simple Log unanswered calls: No Log congestion: No * Registered Backends ------------------- cdr_manager Adaptive ODBC cdr-custom
PBX Data Logger Settings
The logger should work in TCP client mode. The PBX being in permanent listening on port 5038, therefore you need to specify x.x.x.x:5038, where x.x.x.x should be the IP address of your PBX (e.g. 10.0.0.150).
Configuring PBX Data Logger as a TCP client
Our software should work in the TCP client mode. It means that our software will initiate connection with the PBX and the PBX will work as a server. Add one or several PBX IP addresses here (the IP address of the Asterisk [AMI interface]). The port number should match the port that you have defined within the PBX (5038 in the example below).
1. Add a new configuration with the TCP data source (if you didn't it before).

2. Configure the TCP settings as shown below.
![TCP Client Mode - Asterisk [AMI interface]](/pbx/shared/tcp-client-mode.png)
192.168.1.220
5038
192.168.1.220:5038
Selecting the correct parser for Asterisk (AMI interface)

Asterisk (AMI interface)
Asterisk (AMI interface)
Data items
| Description | Data type | Column name |
|---|---|---|
| Account code | string | ACC |
| Destination number | string | DIALED_PHONE |
| Caller ID Name | string | FLAG1 |
| Caller number | string | CALLER_PHONE |
| Call type | string | CALL_TYPE |
| Direction | string | DIRECTION |
| Trunk | string | TRUNK |
| Ext | string | EXT |
| Call time | datetime | CALL_TIME |
| Call duration (sec) | integer | CALL_DURATION_S |
| Call duration | datetime | CALL_DURATION |
| Total duration (sec) | integer | TOTAL_DURATION_S |
| Ring duration (s) | integer | RING_S |
| Ring duration | datetime | RING |
| Call ID | string | FLAG2 |
Sample record
As delivered by the system; phone numbers, names and public addresses are masked.
Event: Cdr Privilege: cdr,all AccountCode: Source: 514xxxxxxx Destination: 701 DestinationContext: ext-group CallerID: "514xxxxxxx" <514xxxxxxx> Channel: SIP/DigiumGateway-000xxxxx DestinationChannel: SIP/221-000xxxxx LastApplication: Dial LastData: UCX/200@200&SIP/221,20,trM(auto-blkvm) StartTime: 2018-12-20 08:04:09 AnswerTime: EndTime: 2018-12-20 08:04:29 Duration: 20 BillableSeconds: 0
Reports and a database
Once records arrive, the logger writes them to a text file or to any ODBC database in real time, or hands them to the PBX Reports utility for manual, scheduled and e-mailed reports with a built-in web server. See exporting call log data to a database for the database setup.
Related Asterisk systems
Aristel AV38Aristel AV38 (DD MM)
Asterisk (CSV)
Asterisk (Master CSV)
All supported PBX systems
Note: Products and companies mentioned here are used only for definition and identification purposes and can be trademarks and/or registered trademarks of the respective companies.
Related topics: Advanced PBX Data Logger
hereCall logging Call accounting SMDR to SQL SMDR Listener Cables and signals