• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to enable Asterisk Database CDR and CEL Logging on Debian 12

  • 00:40 cat /etc/os-release
  • 00:50 asterisk -V
  • 01:00 cd /etc/asterisk
  • 01:15 vim cdr.conf
  • 01:31 vim cdr_custom.conf
  • 02:04 ls /var/log/asterisk/cdr-custom/
  • 02:20 asterisk -rvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
  • 02:36 core reload
  • 03:06 ls /var/log/asterisk/cdr-custom/
  • 03:15 vim /var/log/asterisk/cdr-custom/Mine.csv
  • 03:51 vim cel.conf
  • 04:21 vim cel_custom.conf
  • 05:15 ls /var/log/asterisk/cel-custom/
  • 06:11 vim /var/log/asterisk/cel-custom/Minecel.csv
7751

To Enable Asterisk Database CDR & CEL Logging On Debian 12

Introduction:

CDR (Call Detail Records) and CEL (Call Event Logs) are two types of data reports that Asterisk, a popular open-source PBX (Private Branch Exchange) software, generates to track and record phone call activity.

Procedure Steps:

Step 1: Check the OS version by using the below command.

root@linuxhelp:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL=https://bugs.debian.org/

Step 2: Check the Asterisk version by using the below command.

root@linuxhelp:~# asterisk -V
Asterisk 20.4.0

Step 3: Go to the following location by using the below command.

root@linuxhelp:~# cd /etc/asterisk

Step 4: Open cdr.conf file and make enable by using the below command.

root@linuxhelp:/etc/asterisk# vim cdr.conf
[general]
enable=yes

Step 5: Open cdr_custom.conf file and make the configuration for the cdr by using the below command.

root@linuxhelp:/etc/asterisk# vim cdr_custom.conf
[mappings]
; Our CDR log will be written to /var/log/asterisk/cdr-custom/Master.csv
; with the following schema.
Mine.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},${CSV_QUOTE(${CDR(dstchannel)})},${CSV_QUOTE(${CDR(lastapp)})},${CSV_QUOTE(${CDR(lastdata)})},${CSV_QUOTE(${CDR(start)})},${CSV_QUOTE(${CDR(answer)})},${CSV_QUOTE(${CDR(end)})},${CSV_QUOTE(${CDR(duration)})},${CSV_QUOTE(${CDR(billsec)})},${CSV_QUOTE(${CDR(disposition)})},${CSV_QUOTE(${CDR(amaflags)})},${CSV_QUOTE(${CDR(accountcode)})},${CSV_QUOTE(${CDR(uniqueid)})},${CSV_QUOTE(${CDR(userfield)})},${CDR(sequence)

Step 6: List the files with the path to check if the log file exist by using the below command.

root@linuxhelp:/etc/asterisk# ls /var/log/asterisk/cdr-custom/
Master.csv

Step 7: Login to the asterisk console by using the below command.

root@linuxhelp:~# asterisk -rvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Asterisk 20.4.0, Copyright (C) 1999 - 2022, Sangoma Technologies Corporation and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 20.4.0 currently running on linuxhelp (pid = 1363)
linuxhelp*CLI>

Step 8: Reload the modules to apply the configuration changes by using the below command.

linuxhelp*CLI> core reload
    -- Reloading module 'extconfig' (Configuration)
    -- Reloading module 'logger' (Logger)
 Asterisk Queue Logger restarted
    -- Reloading module 'cdr' (CDR Engine)
[Jan 26 23:11:29] NOTICE[39953]: cdr.c:4568 cdr_toggle_runtime_options: CDR simple logging enabled.
    -- Reloading module 'cel' (CEL Engine)
    -- CEL logging disabled.
    -- Reloading module 'dnsmgr' (DNS Manager)
    -- Reloading module 'dsp' (DSP)
    -- Reloading module 'enum' (ENUM Support)
    -- Reloading module 'features' (Call Features)
    -- Reloading module 'http' (Built-in HTTP Server)
    -- Reloading module 'indications' (Indication Tone Handling)
    -- Reloading module 'acl' (Named ACL system)
    -- Reloading module 'manager' (Asterisk Manager Interface)
    -- Reloading module 'plc' (PLC)
    -- Reloading module 'udptl' (UDPTL)
    -- Reloading module 'res_pjproject.so' (PJPROJECT Log and Utility Support)
    -- Reloading module 'res_pjsip.so' (Basic SIP resource)
[Jan 26 23:11:29] NOTICE[6076]: sorcery.c:1348 sorcery_object_load: Type 'system' is not reloadable, maintaining previous values
    -- Reloading module 'res_pjsip_authenticator_digest.so' (PJSIP authentication resource)
    -- Reloading module 'res_pjsip_endpoint_identifier_ip.so' (PJSIP IP endpoint identifier)
    -- Reloading module 'res_musiconhold.so' (Music On Hold Resource)
    -- Reloading module 'res_rtp_asterisk.so' (Asterisk RTP Stack)
    -- Reloading module 'res_pjsip_outbound_publish.so' (PJSIP Outbound Publish Support)
    -- Reloading module 'res_pjsip_mwi.so' (PJSIP MWI resource)
    -- Reloading module 'res_pjsip_publish_asterisk.so' (PJSIP Asterisk Event PUBLISH Support)
    -- Reloading module 'res_pjsip_notify.so' (CLI/AMI PJSIP NOTIFY Support)
    -- Reloading module 'res_pjsip_outbound_registration.so' (PJSIP Outbound Registration Support)
    -- Reloading module 'cdr_custom.so' (Customizable Comma Separated Values CDR Backend)
    -- Reloading module 'app_playback.so' (Sound File Playback Application)
    -- Reloading module 'app_voicemail.so' (Comedian Mail (Voicemail System))
    -- Reloading module 'pbx_config.so' (Text Extension Configuration)
    -- Time to scan old dialplan and merge leftovers back into the new: 0.000004 sec
    -- Time to restore hints and swap in new dialplan: 0.000002 sec
    -- Time to delete the old dialplan: 0.000004 sec
    -- Total time merge_contexts_delete: 0.000010 sec
    -- pbx_config successfully loaded 1 contexts (enable debug for details).
    -- Reloading module 'app_queue.so' (True Call Queueing)
[Jan 26 23:11:29] NOTICE[39953]: app_queue.c:9528 reload_queue_rules: queuerules.conf has not changed since it was last loaded. Not taking any action.
    -- Reloading module 'cel_custom.so' (Customizable Comma Separated Values CEL Backend)
[Jan 26 23:11:29] NOTICE[39953]: cel_custom.c:92 load_config: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.
 Added CEL CSV mapping for 0 files.

Step 9: Make the call by using microsip application as shown in below image. snap 1

    -- Executing [110@internal:1] NoOp("PJSIP/112-00000018", "Calling 110 From Caller ") in new stack
    -- Executing [110@internal:2] Answer("PJSIP/112-00000018", "") in new stack
       > 0x7f614c033d20 -- Strict RTP learning after remote address set to: 192.168.6.107:4016
    -- Executing [110@internal:3] Dial("PJSIP/112-00000018", "PJSIP/110,10") in new stack
    -- Called PJSIP/110
    -- PJSIP/110-00000019 is ringing
       > 0x7f614c033d20 -- Strict RTP switching to RTP target address 192.168.6.107:4016 as source
  == Spawn extension (internal, 110, 3) exited non-zero on 'PJSIP/112-00000018'

Step 10: Check the log file if exist by using the below command.

root@linuxhelp:/etc/asterisk# ls /var/log/asterisk/cdr-custom/
Master.csv  Mine.csv

Step 11: If exist the log file open and check the logs by using the below command.

root@linuxhelp:/etc/asterisk# vim /var/log/asterisk/cdr-custom/Mine.csv 
"""linuxhelp3"" <112>","112","110","internal","PJSIP/112-00000018","PJSIP/110-00000019","Dial","PJSIP/110,10","2024-01-26 23:11:50","2024-01-26 23:11:50","2024-01-26 23:11:53","3","3","NO ANSWER","DOCUMENTATION","","1706290910.40","",28

Step 12: Open cel.conf file and make enable by using the below command.

root@linuxhelp:/etc/asterisk# vim cel.conf
[general]

; CEL Activation
;
; Use the 'enable' keyword to turn CEL on or off.
;
; Accepted values: yes and no
; Default value:   no

enable=yes

Step 13: Open cel_custom.conf file and make the configuration by using the below command.

root@linuxhelp:/etc/asterisk# vim cel_custom.conf 
[mappings]
Minecel.csv => ${CSV_QUOTE(${eventtype})},${CSV_QUOTE(${eventtime})},${CSV_QUOTE(${CALLERID(name)})},${CSV_QUOTE(${CALLERID(num)})},${CSV_QUOTE(${CALLERID(ANI)})},${CSV_QUOTE(${CALLERID(RDNIS)})},${CSV_QUOTE(${CALLERID(DNID)})},${CSV_QUOTE(${CHANNEL(exten)})},${CSV_QUOTE(${CHANNEL(context)})},${CSV_QUOTE(${CHANNEL(channame)})},${CSV_QUOTE(${CHANNEL(appname)})},${CSV_QUOTE(${CHANNEL(appdata)})},${CSV_QUOTE(${CHANNEL(amaflags)})},${CSV_QUOTE(${CHANNEL(accountcode)})},${CSV_QUOTE(${CHANNEL(uniqueid)})},${CSV_QUOTE(${CHANNEL(linkedid)})},${CSV_QUOTE(${BRIDGEPEER})},${CSV_QUOTE(${CHANNEL(userfield)})},${CSV_QUOTE(${userdeftype})},${CSV_QUOTE(${eventextra})}

Step 14: list the cel log file if exist by using the below command.

root@linuxhelp:/etc/asterisk# ls /var/log/asterisk/cel-custom/

Step 15: Reload the modules to apply the configuration changes by using following command.

linuxhelp*CLI> core reload
    -- Reloading module 'extconfig' (Configuration)
    -- Reloading module 'logger' (Logger)
 Asterisk Queue Logger restarted
    -- Reloading module 'cdr' (CDR Engine)
[Jan 26 23:14:59] NOTICE[39953]: cdr.c:4568 cdr_toggle_runtime_options: CDR simple logging enabled.
    -- Reloading module 'cel' (CEL Engine)
    -- CEL logging enabled.
    -- Reloading module 'dnsmgr' (DNS Manager)
    -- Reloading module 'dsp' (DSP)
    -- Reloading module 'enum' (ENUM Support)
    -- Reloading module 'features' (Call Features)
    -- Reloading module 'http' (Built-in HTTP Server)
    -- Reloading module 'indications' (Indication Tone Handling)
    -- Reloading module 'acl' (Named ACL system)
    -- Reloading module 'manager' (Asterisk Manager Interface)
    -- Reloading module 'plc' (PLC)
    -- Reloading module 'udptl' (UDPTL)
    -- Reloading module 'res_pjproject.so' (PJPROJECT Log and Utility Support)
    -- Reloading module 'res_pjsip.so' (Basic SIP resource)
[Jan 26 23:14:59] NOTICE[6076]: sorcery.c:1348 sorcery_object_load: Type 'system' is not reloadable, maintaining previous values
    -- Reloading module 'res_pjsip_authenticator_digest.so' (PJSIP authentication resource)
    -- Reloading module 'res_pjsip_endpoint_identifier_ip.so' (PJSIP IP endpoint identifier)
    -- Reloading module 'res_musiconhold.so' (Music On Hold Resource)
    -- Reloading module 'res_rtp_asterisk.so' (Asterisk RTP Stack)
    -- Reloading module 'res_pjsip_outbound_publish.so' (PJSIP Outbound Publish Support)
    -- Reloading module 'res_pjsip_mwi.so' (PJSIP MWI resource)
    -- Reloading module 'res_pjsip_publish_asterisk.so' (PJSIP Asterisk Event PUBLISH Support)
    -- Reloading module 'res_pjsip_notify.so' (CLI/AMI PJSIP NOTIFY Support)
    -- Reloading module 'res_pjsip_outbound_registration.so' (PJSIP Outbound Registration Support)
    -- Reloading module 'cdr_custom.so' (Customizable Comma Separated Values CDR Backend)
    -- Reloading module 'app_playback.so' (Sound File Playback Application)
    -- Reloading module 'app_voicemail.so' (Comedian Mail (Voicemail System))
    -- Reloading module 'pbx_config.so' (Text Extension Configuration)
    -- Time to scan old dialplan and merge leftovers back into the new: 0.000003 sec
    -- Time to restore hints and swap in new dialplan: 0.000003 sec
    -- Time to delete the old dialplan: 0.000003 sec
    -- Total time merge_contexts_delete: 0.000009 sec
    -- pbx_config successfully loaded 1 contexts (enable debug for details).
    -- Reloading module 'app_queue.so' (True Call Queueing)
[Jan 26 23:14:59] NOTICE[39953]: app_queue.c:9528 reload_queue_rules: queuerules.conf has not changed since it was last loaded. Not taking any action.
    -- Reloading module 'cel_custom.so' (Customizable Comma Separated Values CEL Backend)
    -- Added CEL CSV mapping for '/var/log/asterisk/cel-custom/Minecel.csv'.
 Added CEL CSV mapping for 1 files.

Step 16: Make the call by using microsip application as shown in below image. snap 2

    -- Executing [110@internal:1] NoOp("PJSIP/112-00000028", "Calling 110 From Caller ") in new stack
    -- Executing [110@internal:2] Answer("PJSIP/112-00000028", "") in new stack
       > 0x7f614c016dd0 -- Strict RTP learning after remote address set to: 192.168.6.107:4034
    -- Executing [110@internal:3] Dial("PJSIP/112-00000028", "PJSIP/110,10") in new stack
    -- Called PJSIP/110
       > 0x7f614c016dd0 -- Strict RTP switching to RTP target address 192.168.6.107:4034 as source
    -- PJSIP/110-00000029 is ringing
  == Spawn extension (internal, 110, 3) exited non-zero on 'PJSIP/112-00000028'
    -- Removed contact 'sip:112@192.168.6.107:63422;transport=TCP;ob' from AOR '112' due to request
  == Contact 112/sip:112@192.168.6.107:63422;transport=TCP;ob has been deleted
  == Endpoint 112 is now Unreachable
    -- Added contact 'sip:112@192.168.6.107:64670;transport=TCP;ob' to AOR '112' with expiration of 300 seconds
  == Endpoint 112 is now Reachable
    -- Contact 112/sip:112@192.168.6.107:64670;transport=TCP;ob is now Reachable.  RTT: 0.465 msec

Step 17: Check the log file if exist by using the below command.

root@linuxhelp:/etc/asterisk# ls /var/log/asterisk/cel-custom/
Minecel.csv

Step 18: If exist the log file open and check the logs by using the below command.

root@linuxhelp:/etc/asterisk# vim /var/log/asterisk/cel-custom/Minecel.csv
"CHAN_START","1706292128.463134","linuxhelp3","112","","","","110","internal","PJSIP/112-00000028","","","3","","1706292128.121","1706292128.121","","","",""
"ANSWER","1706292128.463483","linuxhelp3","112","112","","110","110","internal","PJSIP/112-00000028","Answer","","3","","1706292128.121","1706292128.121","","","",""
"APP_START","1706292128.464302","linuxhelp3","112","112","","110","110","internal","PJSIP/112-00000028","Dial","PJSIP/110,10","3","","1706292128.121","1706292128.121","","","",""
"CHAN_START","1706292128.464771","linuxhelp1","110","","","","s","internal","PJSIP/110-00000029","","","3","","1706292128.125","1706292128.121","","","",""
"HANGUP","1706292132.799587","linuxhelp3","112","112","","110","110","internal","PJSIP/112-00000028","","","3","","1706292128.121","1706292128.121","","","","{""hangupcause"":16,""hangupsource"":""PJSIP/112-00000028"",""dialstatus"":""CANCEL""}"
"CHAN_END","1706292132.799587","linuxhelp3","112","112","","110","110","internal","PJSIP/112-00000028","","","3","","1706292128.121","1706292128.121","","","",""
"HANGUP","1706292132.799657","linuxhelp1","110","110","","","110","internal","PJSIP/110-00000029","AppDial","(Outgoing Line)","3","","1706292128.125","1706292128.121","","","","{""hangupcause"":16,""hangupsource"":"""",""dialstatus"":""""}"
"CHAN_END","1706292132.799657","linuxhelp1","110","110","","","110","internal","PJSIP/110-00000029","AppDial","(Outgoing Line)","3","","1706292128.125","1706292128.121","","","",""

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to enable Asterisk Database CDR & CEL Logging on Debian 12. Your feedback is much welcome.

Tags:
matthew
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What are Call Detail Records (CDR) and Channel Event Logging (CEL) in Asterisk?

A

Call Detail Records (CDR) are logs that contain detailed information about each call that traverses through Asterisk, including call start time, end time, duration, caller ID, dialed number, etc. Channel Event Logging (CEL) provides detailed event logs related to call events, such as call start, hang-up, transfers, etc.

Q

Why should I enable CDR and CEL in Asterisk?

A

Enabling CDR and CEL allows you to track and analyze call activity within your Asterisk system. It's essential for billing purposes, call analysis, troubleshooting, and monitoring the performance of your telephony system.

Q

How do I enable CDR and CEL in Asterisk?

A

You can enable CDR and CEL in the cdr.conf and cel.conf configuration files respectively. Ensure that you have the necessary modules loaded in your Asterisk configuration (cdr_csv.so for CDR and cel_csv.so for CEL).

Q

Can I choose the format of the logs generated by CDR and CEL?

A

Yes, both CDR and CEL can be configured to output logs in different formats. By default, they use CSV (Comma-Separated Values) format, but you can configure them to use other formats such as JSON or SQL.

Q

Where are the CDR and CEL logs stored?

A

By default, CDR and CEL logs are stored in flat files on the Asterisk server. However, you can configure Asterisk to store logs in a database or send them to a remote logging server for centralized management and analysis.

Related Tutorials in How to enable Asterisk Database CDR and CEL Logging on Debian 12

Related Tutorials in How to enable Asterisk Database CDR and CEL Logging on Debian 12

How to install Gparted on Debian 9.0
How to install Gparted on Debian 9.0
Sep 13, 2017
Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache
Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache
Sep 19, 2018
How to install and update OpenSSL on Debian 11.3
How to install and update OpenSSL on Debian 11.3
Oct 21, 2022
How to install qBittorrent on Debian 9.0
How to install qBittorrent on Debian 9.0
Sep 8, 2017
How to Install FileZilla in Debian
How to Install FileZilla in Debian
Nov 29, 2016
How to install Nmap on Debian 9.0
How to install Nmap on Debian 9.0
Sep 9, 2017
How to Install Laravel in Debian
How to Install Laravel in Debian
Dec 7, 2016
How to install Wireshark in Debian
How to install Wireshark in Debian
Mar 18, 2017

Related Forums in How to enable Asterisk Database CDR and CEL Logging on Debian 12

Related Forums in How to enable Asterisk Database CDR and CEL Logging on Debian 12

MariaDB
ryan class=
E: Unable to locate package mariadb-server
Sep 18, 2017
Database
john class=
Warning: mysqli::__construct(): (HY000/2002): No route to host
May 23, 2017
Linux
AadrikaAnshu class=
How to add timestamps to history On Any Linux Machine
Jun 18, 2019
MySQL
gabriel class=
ERROR 1558 (HY000): Column count of mysql.user is wrong. Expected 43, found 42. Created with MySQL 50560, now running 50642
Dec 14, 2018
vim
jacob class=
Change true vi-compatible editor from Debian Vim-compatible
Nov 8, 2021
debian
anandaamatya class=
RedNotebook on Debian buster
Jun 30, 2020
Database
rebeccajazz class=
"could not connect to database server:localhost"
Sep 25, 2018
Database
stewart class=
Cannot drop a table in MySQL Database
Feb 14, 2018

Related News in How to enable Asterisk Database CDR and CEL Logging on Debian 12

Related News in How to enable Asterisk Database CDR and CEL Logging on Debian 12

Debian IceDove kicks the bucket after Thunderbird revisits Debian Repositories
Debian IceDove kicks the bucket after Thunderbird revisits Debian Repositories
Feb 28, 2017
Mass update of Jessie - A better alternative to new version?
Mass update of Jessie - A better alternative to new version?
May 8, 2017
Security breach in Indiana Pacers Database
Security breach in Indiana Pacers Database
May 24, 2019
GandCrab Ransomware Infection Made by Scanning MySQL Databases
GandCrab Ransomware Infection Made by Scanning MySQL Databases
May 28, 2019
Debian 9.2 ‘Stretch’ OS is here, download distro now
Debian 9.2 ‘Stretch’ OS is here, download distro now
Oct 9, 2017
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luke ?
workbench for debian

I am using workbench in CentOS whereas now I need to use Debian Operating system so could you please help to install and use in Debian?

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.