we have a secondary mysql server, which listens to a different port 6033,
this works in version 15, but we are trying to migrate to 17 and there it doesn't work
this is exactly like i i expect, but then it's just ignored
$dsnarr['port'] = '3306'; // initialize with default port
and after that the following block could also overwrite this port
if (isset($amp_conf['AMPDBPORT'])) {
// Make sure this is an int
$port = (int) $amp_conf['AMPDBPORT'];
if ($port > 1024) {
$dsnarr['port'] = $port;
}
}
i think the whole block should be wrapped in a if check, that if a port is supplied in the configuration it should not be overwritten
something like this should work
if(!array_key_exists('port', $dsnarr) || $dsnarr['port'] == '' || $dsnarr['port'] == 0) {
$dsnarr['port'] = '3306'; // initialize with default port
// We only want to add port to the DSN if it's actually defined.
if (isset($amp_conf['AMPDBPORT'])) {
// Make sure this is an int
$port = (int) $amp_conf['AMPDBPORT'];
if ($port > 1024) {
$dsnarr['port'] = $port;
}
}
}
unrelated issue
The freepbx interface breaks when the CDR databaselink is not reachable, and the only way to fix the configuration is by editing the freepbx database by hand
update freepbx_settings set value='' where keyword in ('CDRDBHOST','CDRDBPASS','CDRDBPORT','CDRDBUSER');
Operating Environment
Installation: fresh debian bookworm instance, and added proxysql 2.6 and freepbx installed on with the installscript provided by freepbx
after installing we registered our install with the commandline and restored a backup so we could test the upgrade
OS: debian bookworm 12.7, all updates installed
From freepbx:
PBX Version: 17.0.19.13
PBX Distro: 12.7.8-2408-1.sng12
Asterisk Version: 21.4.3
root@freepbx-test:~# dpkg -s freepbx17 | grep -i version
Version: 17.1-1.sng12
root@freepbx-test:~# dpkg -s asterisk21 | grep Version
Version: 21.4.3-1.sng12
snapshots from the browser, i couldn't find the log where this is logged
Exception
Unable to connect to CDR Database
/var/www/html/admin/modules/cdr/Cdr.class.php
} else {
throw new \Exception("Datasource set to sqlite, but no cdrdatasource or datasource provided");
}
$user = "";
$pass = "";
} else {
// Not SQLite.
$user = $cdr["CDRDBUSER"];
$pass = $cdr["CDRDBPASS"];
// Note - http_build_query() is a simple shortcut to change a key=>value array
// to a string.
$dsn = "$engine:".http_build_query($dsnarray, '', ';');
}
// Now try to get a DB handle using our DSN
try {
$this->cdrdb = new \Database($dsn, $user, $pass);
} catch(\Exception $e) {
throw new \Exception('Unable to connect to CDR Database');
}
//Set the CDR session timezone to GMT if CDRUSEGMT is true
if (isset($cdr["CDRUSEGMT"]) && $cdr["CDRUSEGMT"]) {
$sql = "SET time_zone = '+00:00'";
$sth = $this->cdrdb->prepare($sql);
$sth->execute();
}
}
public function getCdrDbHandle() {
// Simply returns the DB Handle created in __construct
return $this->cdrdb;
}
public function ucpDelGroup($id,$display,$data) {
}
/* UCP template to get the user assigned vm extension details
* @defaultexten is the default_extensionof the userman userid
* @userid is userman user id
Arguments
"Unable to connect to CDR Database"
FreePBX Version
FreePBX 17
Issue Description
we have a secondary mysql server, which listens to a different port 6033, this works in version 15, but we are trying to migrate to 17 and there it doesn't work
the problem is on this line and after this $dsnarr['port'] = '3306'; // initialize with default port
what happens is that the input
mysql:dbname=asteriskcdrdb;host=127.0.0.2;port=6033
is parsedthis results in
this is exactly like i i expect, but then it's just ignored
$dsnarr['port'] = '3306'; // initialize with default port
and after that the following block could also overwrite this port
i think the whole block should be wrapped in a if check, that if a port is supplied in the configuration it should not be overwritten
something like this should work
unrelated issue The freepbx interface breaks when the CDR databaselink is not reachable, and the only way to fix the configuration is by editing the freepbx database by hand
update freepbx_settings set value='' where keyword in ('CDRDBHOST','CDRDBPASS','CDRDBPORT','CDRDBUSER');
Operating Environment
Installation: fresh debian bookworm instance, and added proxysql 2.6 and freepbx installed on with the installscript provided by freepbx after installing we registered our install with the commandline and restored a backup so we could test the upgrade
OS: debian bookworm 12.7, all updates installed
From freepbx:
root@freepbx-test:~# dpkg -s freepbx17 | grep -i version Version: 17.1-1.sng12
root@freepbx-test:~# dpkg -s asterisk21 | grep Version Version: 21.4.3-1.sng12
Relevant log output