Hello Everybody, I am trying to configure Asterisk to listen into a database which is created in PostgreSQL. Whenever asterisk starts up, it is unable to connect to the pg database and gives the following error: [cdr_pgsql.so] => (PostgreSQL CDR Backend) == Parsing '/etc/asterisk/cdr_pgsql.conf': Found Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:284 my_load_module: cdr_pgsql: got hostname of localhost Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:285 my_load_module: cdr_pgsql: got port of 5432 Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:288 my_load_module: cdr_pgsql: got user of asteriskpg Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:289 my_load_module: cdr_pgsql: got dbname of asteriskpgcdr Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:290 my_load_module: cdr_pgsql: got password of 65plesk Jun 24 21:20:53 ERROR[1074494336]: cdr_pgsql.c:298 my_load_module: cdr_pgsql: Unable to connect to database server localhost. Calls will not be logged! Jun 24 21:20:53 ERROR[1074494336]: cdr_pgsql.c:299 my_load_module: cdr_pgsql: Reason: could not connect to server: Connection refused Is the server running on host localhost and accepting TCP/IP connections on port 5432? However, the strange thing is that when I try to connect to this database using the command prompt, it puts me through! :) Only when Asterisk tries to connect to the postgresql database does it not work. Any idea why this is happening? Many thanks in advance Cheers
On Thu, Jun 24, 2004 at 09:05:42PM +0800, Caleb Kow wrote:> Jun 24 21:20:53 ERROR[1074494336]: cdr_pgsql.c:299 my_load_module: > cdr_pgsql: Reason: could not connect to server: Connection refused > Is the server running on host localhost and accepting > TCP/IP connections on port 5432? > > However, the strange thing is that when I try to connect to this > database using the command prompt, it puts me through! :) Only when > Asterisk tries to connect to the postgresql database does it not work. > Any idea why this is happening?Asterisk is trying to connect to the postgresql postmaster. "netstat -na |grep 5432" should show a line with LISTEN, if it does not then postgres is not accepting tcp connections. postmaster needs the -i option to accept tcp connections. The startup script, perhaps /etc/init.d/postgresql needs the command line to pg_ctl add the -i option to postmaster's command line. Something like: /usr/bin/pg_ctl -p /usr/bin/postmaster -o '-p 5432 -i' start with whatever other options are already there. Then after a restart, asterisk should be able to connect to postgres. -- -- Sam Tilders sam@jovianprojects.com.au (Move to Jupiter)
Caleb Kow wrote:> Hello Everybody, > > I am trying to configure Asterisk to listen into a database which is > created in PostgreSQL. Whenever asterisk starts up, it is unable to > connect to the pg database and gives the following error: > > [cdr_pgsql.so] => (PostgreSQL CDR Backend) > == Parsing '/etc/asterisk/cdr_pgsql.conf': Found > Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:284 my_load_module: > cdr_pgsql: got hostname of localhost > Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:285 my_load_module: > cdr_pgsql: got port of 5432 > Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:288 my_load_module: > cdr_pgsql: got user of asteriskpg > Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:289 my_load_module: > cdr_pgsql: got dbname of asteriskpgcdr > Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:290 my_load_module: > cdr_pgsql: got password of 65plesk > Jun 24 21:20:53 ERROR[1074494336]: cdr_pgsql.c:298 my_load_module: > cdr_pgsql: Unable to connect to database server localhost. Calls will > not be logged! > Jun 24 21:20:53 ERROR[1074494336]: cdr_pgsql.c:299 my_load_module: > cdr_pgsql: Reason: could not connect to server: Connection refused > Is the server running on host localhost and accepting > TCP/IP connections on port 5432? > > However, the strange thing is that when I try to connect to this > database using the command prompt, it puts me through! :) Only when > Asterisk tries to connect to the postgresql database does it not work. > Any idea why this is happening?Can you do a netstat -ap ? -- Linux Home Automation Neil Cherry ncherry@comcast.net http://home.comcast.net/~ncherry/ (Text only) http://linuxha.sourceforge.net/ (SourceForge) http://hcs.sourceforge.net/ (HCS II)
Looks like PostgreSQL is running in UNIX local socket mode (which is default) and does not allow incoming TCP/IP connections even for localhost. Did you check for "tcpip_socket = true" line in your postgresql.conf file (it is /var/lib/pgsql/data/ directory on my system)? You can also check permissions in pg_hba.conf in the same directory. Ivan Gostev Caleb Kow wrote:> Hello Everybody, > > I am trying to configure Asterisk to listen into a database which is > created in PostgreSQL. Whenever asterisk starts up, it is unable to > connect to the pg database and gives the following error: > > [cdr_pgsql.so] => (PostgreSQL CDR Backend) > == Parsing '/etc/asterisk/cdr_pgsql.conf': Found > Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:284 my_load_module: > cdr_pgsql: got hostname of localhost > Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:285 my_load_module: > cdr_pgsql: got port of 5432 > Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:288 my_load_module: > cdr_pgsql: got user of asteriskpg > Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:289 my_load_module: > cdr_pgsql: got dbname of asteriskpgcdr > Jun 24 21:20:53 DEBUG[1074494336]: cdr_pgsql.c:290 my_load_module: > cdr_pgsql: got password of 65plesk > Jun 24 21:20:53 ERROR[1074494336]: cdr_pgsql.c:298 my_load_module: > cdr_pgsql: Unable to connect to database server localhost. Calls will > not be logged! > Jun 24 21:20:53 ERROR[1074494336]: cdr_pgsql.c:299 my_load_module: > cdr_pgsql: Reason: could not connect to server: Connection refused > Is the server running on host localhost and accepting > TCP/IP connections on port 5432? > > However, the strange thing is that when I try to connect to this > database using the command prompt, it puts me through! :) Only when > Asterisk tries to connect to the postgresql database does it not work. > Any idea why this is happening? > > Many thanks in advance > > Cheers > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > > . >
Hi *'s, Back Again I want to use PostgreSQL instead of MySQL, basically i want to create an application (calling card),firstly i am not be able to connecting postgres to my asterisks i made some configuration in odbc.ini,odbcinst.ini cdr_pgsql etc but no luck asterisk doesn't recognize it unknown host name error displayed my asterisk's server name is asterisk also my database name is asterisk ,searches wiki alot but almost all info about MySQL i have facing difficulties to connect PostgreSQL from asterisk what files i'll change to properly setup PostgreSQL with Asterisk any help is highly appreciated. This is my second post on this issue no responce on first one so plz take a while . Thanks In Advance. Adnan Ahmed.