/3CX-Cdr-Tcp-Server

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Multilanguage README Pattern

en fr swe

Recording 3CX CDRs into a PostgreSql database with Grafana

Description

This tool facilitates the recording of 3CX CDRs into a PostgreSql database and the creation of dashboards using Grafana.

Installation

To utilize all features, installation via Docker is necessary. This image contains 5 containers:

  • TCP Server / FTP- SFTP - SCP Client
  • WebAPI server
  • Postgres v12 container
  • PgAdmin container
  • Grafana container for dashboards

Configuration

  1. Basic parameters should be provided in a .env file at the root directory following the .env_template model.
  2. Configuration settings need to be applied on the 3CX server as indicated below:
    CDR Configuration

Configuring CDRs in 3CX:

  • For TCP transfer: Ensure to indicate "3CX CDR service is client / Active Socket" for the 3CX server to connect to our TCP server.
  • For FTP/SFTP/SCP transfer: Ensure file generation. It's recommended to generate 1 file per call for seamless integration throughout the day. Note that this mode requires setting up an FTP server where CDR files will be available and accessible by the application. In the configuration file, you can choose to archive files on the FTP server; they will be renamed to .old, or to delete them. In any case, files are backed up after processing in the LOCAL_CDR_FOLDER_ARCHIVE directory specified in the .env file and mounted on the server running the Docker stack.
  • The CDR configuration in 3CX should follow this order:
  • historyid
  • callid
  • duration
  • time_start
  • time_answered
  • time_end
  • reason_terminated
  • from_no
  • to_no
  • from_dn
  • to_dn
  • dial_no
  • reason_changed
  • final_number
  • final_dn
  • bill_code
  • bill_rate
  • bill_cost
  • bill_name
  • chain
  • from_type
  • to_type
  • final_type
  • from_dispname
  • to_dispname
  • final_dispname
  • missed_queue_calls

Logs:

Log files are located in the directory: /home/appuser/app/logs.

Contributions

If you like my work, don't hesitate to buy me a coffee, a beer or any other drink