How to Enable CDR and CEL Logging on Database
To Enable CDR & CEL Logging on Database
Introduction
CDR is Call Detail Record, which provides logging services via a variety of pluggable backend modules. Detailed call information can be recorded in databases, files, etc.
CEL (Channel Event Logging) provides a mechanism for tracking many channel-related events.
Procedure
Step 1: Check the OS version by using the below command
root@linuxhelp1: ~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
Step 2 : Check the status of the Asterisk by using the below command
root@linuxhelp1:~# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
Loaded: loaded (/etc/init.d/asterisk; generated)
Active: active (running) since Thu 2023-07-27 07:25:18 IST; 3 weeks 0 days ago
Docs: man:systemd-sysv-generator(8)
Tasks: 72 (limit: 4537)
Memory: 122.0M
CPU: 13min 50.846s
CGroup: /system.slice/asterisk.service
└─1427 /usr/sbin/asterisk
Jul 27 07:25:18 linuxhelp1 systemd[1]: Starting LSB: Asterisk PBX...
Jul 27 07:25:18 linuxhelp1 asterisk[1404]: * Starting Asterisk PBX: asterisk
Jul 27 07:25:18 linuxhelp1 asterisk[1404]: ...done.
Jul 27 07:25:18 linuxhelp1 systemd[1]: Started LSB: Asterisk PBX.
Jul 27 07:25:25 linuxhelp1 asterisk[1427]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusclie>
Jul 27 07:25:25 linuxhelp1 asterisk[1427]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusclie>
Step 3: Move to the Asterisk directory by using the below command
root@linuxhelp1:~# cd /etc/asterisk/
Step 4: List the Asterisk directory by using the below command
root@linuxhelp1:/etc/asterisk# ls
1 cel_sqlite3_custom.conf http.conf res_http_media_cache.conf
acl.conf cel_tds.conf iax.conf res_ldap.conf
adsi.conf chan_dahdi.conf iaxprov.conf res_odbc.conf
aeap.conf chan_mobile.conf indications.conf resolver_unbound.conf
agents.conf cli_aliases.conf logger.conf res_parking.conf
alarmreceiver.conf cli.conf manager.conf res_pgsql.conf
alsa.conf cli_permissions.conf meetme.conf res_pktccops.conf
amd.conf codecs.conf mgcp.conf res_snmp.conf
app_skel.conf confbridge.conf minivm.conf res_stun_monitor.conf
ari.conf config_test.conf modules.conf rtp.conf
ast_debug_tools.conf console.conf motif.conf say.conf
asterisk.adsi dbsep.conf musiconhold.conf sip.conf
asterisk.conf dnsmgr.conf ooh323.conf sip_notify.conf
calendar.conf dsp.conf osp.conf skinny.conf
ccss.conf dundi.conf phoneprov.conf sla.conf
cdr_adaptive_odbc.conf enum.conf pjproject.conf smdi.conf
cdr_beanstalkd.conf extconfig.conf pjsip.conf sorcery.conf
cdr.conf extensions.ael pjsip.conf_backup ss7.timers
cdr_custom.conf extensions.conf pjsip.conf_backup2 stasis.conf
cdr_manager.conf extensions.conf.1 pjsip_notify.conf statsd.conf
cdr_odbc.conf extensions.conf_backup pjsip_wizard.conf stir_shaken.conf
cdr_pgsql.conf extensions.lua prometheus.conf telcordia-1.adsi
cdr_sqlite3_custom.conf extensions_minivm.conf queuerules.conf test_sorcery.conf
cdr_tds.conf features.conf queues.conf udptl.conf
cel_beanstalkd.conf festival.conf res_config_mysql.conf unistim.conf
cel.conf followme.conf res_config_sqlite3.conf users.conf
cel_custom.conf func_odbc.conf res_corosync.conf voicemail.conf
cel_odbc.conf geolocation.conf res_curl.conf xmpp.conf
cel_pgsql.conf hep.conf res_fax.conf
Step 5: Edit the cdr.conf file to enable cdr log by using the below command
root@linuxhelp1:/etc/asterisk# vim cdr.conf
Step 6: Move to the asterisk log directory by using the below command
root@linuxhelp1:/etc/asterisk# cd /var/log/asterisk/
Step 7: List the Asterisk log directory by using the below command
root@linuxhelp1:/var/log/asterisk# ls
cdr-csv cdr-custom cel-custom h323_log messages.log queue_log
Step 8: Move to the Asterisk directory by using the below command
root@linuxhelp1:/var/log/asterisk# cd /etc/asterisk/
Step 9: Now enable the CEL log for that edit the cel.conf file by using the below command
root@linuxhelp1:/etc/asterisk# vim cel.conf
Step 10: For customize the CEL log edit the cel_custom.conf file by using the below command
root@linuxhelp1:/etc/asterisk# vim cel_custom.conf
Step 11: Restart the Asterisk for reflect the changes by using the below command
root@linuxhelp1:/etc/asterisk# systemctl restart asterisk
Step 12: Move to the Asterisk log directory by using the below command
root@linuxhelp1:/etc/asterisk# cd /var/log/asterisk/
Step 13: List the asterisk log directory by using the below command
root@linuxhelp1:/var/log/asterisk# ls
cdr-csv cdr-custom cel-custom h323_log messages.log queue_log
Step 14: Move to the cel-custom directory by using the below command
root@linuxhelp1:/var/log/asterisk# cd cel-custom/
Step 15: List the directory by using the below command
root@linuxhelp1:/var/log/asterisk/cel-custom# ls
Step 16: After call from one extension to another extension again list the directory by using the below command
root@linuxhelp1:/var/log/asterisk/cel-custom# ls
Custom.csv
Step 17: View the CEL custom file by using tail command
root@linuxhelp1:/var/log/asterisk/cel-custom# tail -f Custom.csv
"CHAN_START","1692284378.172848","linuxhelp1","167","","","","168","internal","PJSIP/167-00000000","","","3","","1692284378.0","1692284378.0","","","",""
"ANSWER","1692284378.174561","linuxhelp1","167","167","","168","168","internal","PJSIP/167-00000000","Answer","","3","","1692284378.0","1692284378.0","","","",""
"HANGUP","1692284379.614430","linuxhelp1","167","167","","168","168","internal","PJSIP/167-00000000","","","3","","1692284378.0","1692284378.0","","","","{""hangupcause"":16,""hangupsource"":""PJSIP/167-00000000"",""dialstatus"":""""}"
"CHAN_END","1692284379.614430","linuxhelp1","167","167","","168","168","internal","PJSIP/167-00000000","","","3","","1692284378.0","1692284378.0","","","",""
^C
Step 18 : View the CDR custom file by using tail command
root@linuxhelp1:/var/log/asterisk/cdr-custom# tail -f Cdr_custom.csv
"""linuxhelp1"" <167>","167","168","internal","PJSIP/167-00000000","","AMD","","2023-08-17 20:31:54","2023-08-17 20:31:54","2023-08-17 20:31:55","1","1","ANSWERED","DOCUMENTATION","","1692284514.0","",0
Conclusion:
By this how to enable CDR & CEL Logging on Database has come to an end.