Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

FOP2 Community Forum

  1. Home
  2. Support
  3. Call Recording unable to connect to DB on FreePBX 15

Call Recording unable to connect to DB on FreePBX 15

Scheduled Pinned Locked Moved Support
2 Posts 1 Posters 176 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    J
    JaredBusch
    wrote on last edited by
    #1

    FreePBX moved the DB credentials out of etc/amportal.conf quite some time ago now.
    But they left the file in place with other information still. Because of that, the logic in config.php is 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);
    
    1 Reply Last reply
    0
    • J
      J
      JaredBusch
      wrote on last edited by
      #2

      It seems something about the subsequent if logic to after the amportal check is not working. Going only to the /etc/freepbx.conf does work as I simply commented out the block and added the if because 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

      1 Reply Last reply
      0

      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
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      Powered by NodeBB Contributors
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups