Call Recording unable to connect to DB on FreePBX 15
-
FreePBX moved the DB credentials out of
etc/amportal.confquite some time ago now.
But they left the file in place with other information still. Because of that, the logic inconfig.phpis no longer valid.if(!$db->is_connected()) { // Database connection details from amportal =begin comment This logic is invalid on FreePBX 15 as /etc/amportal.conf still exists. if (is_readable("/etc/amportal.conf")) { $amp_conf = parse_amportal_conf("/etc/amportal.conf"); $DBHOST = $amp_conf['AMPDBHOST']; $DBNAME = $amp_conf['AMPDBNAME']; $DBUSER = $amp_conf['AMPDBUSER']; $DBPASS = $amp_conf['AMPDBPASS']; if(!isset($amp_conf['AMPDBENGINE'])) { if(is_file("/etc/freepbx/freepbx.conf")) { $amp_conf = parse_amportal_conf("/etc/freepbx/freepbx.conf"); } else if(is_file("/etc/freepbx.conf")) { $amp_conf = parse_amportal_conf("/etc/freepbx.conf"); } $DBHOST = $amp_conf['AMPDBHOST']; $DBNAME = $amp_conf['AMPDBNAME']; $DBUSER = $amp_conf['AMPDBUSER']; $DBPASS = $amp_conf['AMPDBPASS']; } } else if (is_readable("/etc/freepbx/freepbx.conf")) { $amp_conf = parse_amportal_conf("/etc/freepbx/freepbx.conf"); $DBHOST = $amp_conf['AMPDBHOST']; $DBNAME = $amp_conf['AMPDBNAME']; $DBUSER = $amp_conf['AMPDBUSER']; $DBPASS = $amp_conf['AMPDBPASS']; } else if (is_readable("/etc/freepbx.conf")) { =end comment =cut if (is_readable("/etc/freepbx.conf")) { $amp_conf = parse_amportal_conf("/etc/freepbx.conf"); $DBHOST = $amp_conf['AMPDBHOST']; $DBNAME = $amp_conf['AMPDBNAME']; $DBUSER = $amp_conf['AMPDBUSER']; $DBPASS = $amp_conf['AMPDBPASS']; } else if (is_readable("/etc/asterisk/snep/snep-features.conf")) { $DBHOST = 'localhost'; $DBNAME = 'snep'; $DBUSER = 'snep'; $DBPASS = 'sneppass'; $CDRDBTABLE = "snep.cdr"; } $db = new dbcon($DBHOST, $DBUSER, $DBPASS, $DBNAME, true, true, $FORCE_UTF8); -
It seems something about the subsequent if logic to after the amportal check is not working. Going only to the
/etc/freepbx.confdoes work as I simply commented out the block and added theifbecause it does not apply to the install. but obviously, you need to actually fix the logic so it works for various systems.
This is the error I was getting

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login