You need to make sure ODBC is actually getting a connection made with your database.
What you should see under ODBC DSN settings: Name: asterisk DSN: asterisk-connector Last connection attempt: WHATEVER Pooled: No/Yes Connected: Yes Connected: Yes is the important part. Remember, you need to have an account in postgres that can be logged into. I made one on my machine with the following: name = asterisk password = secret And in /etc/odbc.ini, I have the following connector established: [asterisk-connector] Description = PostgreSQL connection to 'asterisk' database Driver = PostgreSQL Database = asterisk Servername = localhost UserName = asterisk Password = secret Port = 5432 Protocol = 8.1 <I'm guessing this will be 9.1 in your case> ReadOnly = No RowVersioning = No ShowSystemTables = No ShowOidColumn = No FakeOidIndex = No ConnSettings = While my res_odbc.conf looks like this: [asterisk] enabled => yes dsn => asterisk pre-connect => yes In addition to having a connector defined, you need to have an ODBC adapter for postgres. I think this might come with ODBC byd efault though. When I was using mysql, I had to get a separate adapter to make it work and set the path to it in Driver. I don't think that is the case with pgsql though. Go ahead and post your extconfig.conf. I'm guessing that the reason you are able to post CDRs in spite of not having the Connected status show up in your ODBC show is because you are connecting with res_pgsql.conf instead of odbc. ----- Original Message ----- From: "Sergio Basurto" <sbasu...@soft-gator.com> To: asterisk-users@lists.digium.com Sent: Wednesday, February 22, 2012 6:54:47 AM Subject: Re: [asterisk-users] Postgresql in Asterisk On Wed, 2012-02-22 at 06:48 -0600, Sergio Basurto wrote: Hello, I install asterisk an postgresql 9.1 in gentoo, I already did the configuration in both asterisk and postgresql, in fact If I make a call and asterisk log it to CDR table, my question is: I make a typo mistake I mean If I make a call asterisk already log it into CDR table. how can I make a function like the ones in func_odbc.conf for postgresql, if I am using res_pgsql.conf instead of res_odbc.conf? I also configure odbc and it connects with echo "select 1" | isql -v asterisk-connector with out problems, but when I try an odbc function or restart asterisk it logs: Error SQLConnect=-1 errno=101 [unixODBC]Could not connect to the server; Could not connect to remote socket. and the command CLI> odbc show ODBC DSN Settings ----------------- Name: asterisk DSN: asterisk-connector Last connection attempt: 2012-02-22 06:45:36 I will appreciate any help. Regards, -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Sergio Basurto < sbasu...@soft-gator.com > Soft Gator S.A de C.V. -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users