Skip to content

Centralize PostgreSQL CDR database configuration using FreeSwitch variables#3

Draft
Copilot wants to merge 7 commits intomasterfrom
copilot/update-fusionpbx-config
Draft

Centralize PostgreSQL CDR database configuration using FreeSwitch variables#3
Copilot wants to merge 7 commits intomasterfrom
copilot/update-fusionpbx-config

Conversation

Copy link

Copilot AI commented Feb 3, 2026

FusionPBX CDR configuration had hardcoded PostgreSQL credentials (host=localhost user=postgres password=nopassword) that didn't match the actual database config in /etc/fusionpbx/config.conf, forcing users to maintain separate ODBC connections for billing.

Changes

Configuration centralization via vars.xml:

  • Added dsn_cdr variable for PostgreSQL connection string (format: host=<host> user=<user> password=<pass> dbname=<db> connect_timeout=10)
  • Added dsn_voicemail variable for optional ODBC DSN (format: dsn_name:username:password, falls back to SQLite if empty)

Module configuration updates:

  • cdr_pg_csv.conf.xml: Changed db-info param from hardcoded string to $${dsn_cdr} variable
  • voicemail.conf.xml: Changed odbc-dsn param to $${dsn_voicemail} variable

Configuration interface:
Variables can be updated via:

  1. Web UI: Advanced → Variables → dsn_cdr
  2. Direct edit: /etc/freeswitch/vars.xml
  3. Automated script: ./configure_postgresql_cdr.sh (reads from /etc/fusionpbx/config.conf)

Before/After

Before:

<param name="db-info" value="host=localhost user=postgres password=nopassword dbname=fusionpbx connect_timeout=10" />

After:

<!-- vars.xml -->
<X-PRE-PROCESS cmd="set" data="dsn_cdr=host=127.0.0.1 user=fusionpbx password=CHANGE_ME dbname=fusionpbx connect_timeout=10" category="Database" enabled="true"/>

<!-- cdr_pg_csv.conf.xml -->
<param name="db-info" value="$${dsn_cdr}" />

Implementation Notes

  • Default password set to CHANGE_ME to make misconfiguration obvious
  • Script includes proper escaping for special characters in connection strings
  • No changes to CDR schema or existing functionality
  • Backward compatible: existing installations continue working until variables are configured

Documentation

  • POSTGRESQL_CDR_CONFIGURATION.md: Setup guide, connection string format, troubleshooting
  • configure_postgresql_cdr.sh: Automated configuration script with backup creation
  • DEPLOYMENT_CHECKLIST.md: Production deployment verification steps
Original prompt

fusionpbx already preinstalled and configred with postgresdb
root@vmi3009921:/etc/fusionpbx# cat config.conf

#database system settings
database.0.type = pgsql
database.0.host = 127.0.0.1
database.0.port = 5432
database.0.sslmode = prefer
database.0.name = fusionpbx
database.0.username = fusionpbx
database.0.password = Mh3FFWl8VFEGuYQ6EientF1ETA

#database switch settings
database.1.type = sqlite
database.1.path = /var/lib/freeswitch/db
database.1.name = core.db

#general settings
document.root = /var/www/fusionpbx
project.path =
temp.dir = /tmp
php.dir = /usr/bin
php.bin = php

#session settings
session.cookie_httponly = true
session.cookie_secure = true
session.cookie_samesite = Lax

#cache settings
cache.method = file
cache.location = /var/cache/fusionpbx
cache.settings = true

#switch settings
switch.conf.dir = /etc/freeswitch
switch.sounds.dir = /usr/share/freeswitch/sounds
switch.database.dir = /var/lib/freeswitch/db
switch.recordings.dir = /var/lib/freeswitch/recordings
switch.storage.dir = /var/lib/freeswitch/storage
switch.voicemail.dir = /var/lib/freeswitch/storage/voicemail
switch.scripts.dir = /usr/share/freeswitch/scripts

#switch xml handler
xml_handler.fs_path = false
xml_handler.reg_as_number_alias = false
xml_handler.number_as_presence_id = true

#error reporting options: user,dev,all
error.reporting = user
why should create new db odbc with postgress- please made all required change depends on provide config and insert all billling db with existing database -
root@vmi3009921:/etc/fusionpbx#


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 6 commits February 3, 2026 19:27
Co-authored-by: mostakinads-design <258886467+mostakinads-design@users.noreply.github.com>
Co-authored-by: mostakinads-design <258886467+mostakinads-design@users.noreply.github.com>
Co-authored-by: mostakinads-design <258886467+mostakinads-design@users.noreply.github.com>
…ve sed escaping

Co-authored-by: mostakinads-design <258886467+mostakinads-design@users.noreply.github.com>
Co-authored-by: mostakinads-design <258886467+mostakinads-design@users.noreply.github.com>
Co-authored-by: mostakinads-design <258886467+mostakinads-design@users.noreply.github.com>
Copilot AI changed the title [WIP] Update FusionPBX configuration settings Centralize PostgreSQL CDR database configuration using FreeSwitch variables Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants