Superfecta and postgres schema

Hi, I’m trying to connect my erp phonebook with superfecta but I get error in db connection.
Erp uses postgres db. It’s installed on frepbx server.
Is it available a sample for this kind of connections?
My data looks like: server:localhost:5432; DB: el username:USERNAME; password: PASSWORD; SQL: SELECT teldata as data FROM contacts WHERE telnr like [NUMBER];

Maybe I do some mistakes compiling the form of schema_Postgres_DB.
Thanks in advance.

What Superfecta module are you using? I don’t see where superfecta supports postgres lookups. has PostgreSQL_BB schema included.


<?php //this file is designed to be used as an include that is part of a loop. //If a valid match is found, it should give $caller_id a value //available variables for use are: $thenumber //retreive website contents using get_url_contents($url); //configuration / display parameters //The description cannot contain "a" tags, but can contain limited HTML. Some HTML (like the a tags) will break the UI. $source_desc = "Query a local or remote PostgreSQL database. Requires non-standard dependancy, PostgreSQL for PHP"; $source_param = array(); $source_param['DB_Host']['desc'] = 'Host address of the database. (localhost if the database is on the same server as FreePBX)'; $source_param['DB_Host']['type'] = 'text'; $source_param['DB_Name']['desc'] = 'schema name of the database'; $source_param['DB_Name']['type'] = 'text'; $source_param['DB_User']['desc'] = 'Username used to connect to the database'; $source_param['DB_User']['type'] = 'text'; $source_param['DB_Password']['desc'] = 'Password used to connect to the database'; $source_param['DB_Password']['type'] = 'password'; $source_param['SQL_Query']['desc'] = 'SQL Query used to retrieve the Dialer Name. select result as data from table where telfield like [NUMBER]. "as data" is important, NUMMBER will be replaced by the calle$ $source_param['SQL_Query']['type'] = 'text'; //run this if the script is running in the "get caller id" usage mode. if($usage_mode == 'get caller id') { $wresult_caller_name = ""; if($debug) { print "Searching PostgreSQL Database... "; } $wquery_input = preg_replace("/\D/","",$thenumber); // strip non-digits if (strlen($wquery_input) == 0) exit; // abandon search if no number is passed $wdb_handle = pg_connect("host=".$run_param['DB_Host']." dbname=".$run_param['DB_Name']." user=".$run_param['DB_User']." password=".$run_param['DB_Password']) or die("PostgreSQL connection failed" .$ pg_query("SET NAMES 'utf8'") or die("UTF8 set query failed: " . pg_result_error($wdb_handle)); $wquery_string =$run_param['SQL_Query']; $wquery_string = str_replace('[NUMBER]', $wquery_input, $wquery_string); //print $wquery_string; $wquery_result = pg_query($wquery_string) or die("PostgreSQL query failed" . pg_result_error($wdb_handle)); //print $wquery_result; if(pg_num_rows($wquery_result) > 0) { $wquery_row = pg_fetch_array($wquery_result); $wresult_caller_name = $wquery_row["data"]; } if ($wresult_caller_name != "") { $caller_id = strip_tags($wresult_caller_name); } else if($debug) { print "not found

Superfecta 2.x is loooooong deprecated now, but you may still get it to work. You need to ensure that PostgreSQL for PHP is installed on your system, which is not installed by default on some distros. You may also run into issues trying to use Superfecta 2.x on reasonably modern installs because your PHP version is newer than what old Superfecta versions were developed for.

A far better plan would be to upgrade to a supported version of Superfecta, and assist the devs in migrating the PostgreSQL_DB module to the current version. If you wish to explore this start a new issue on the dev site.

Ok, I’ll do my best. But to be onest my superfecta is perfect. I use Asterisk Phonebook joined with google contacts, Paginebianche, Asteridex without any kind of problem. Stable and…perfect!!!
With the connection to erp system I’ll get the best system of the world!!!