<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.32.2">
</HEAD>
<BODY>
Thank you Jonathan,<BR>
<BR>
I already do the steps you mention, my configuration is:<BR>
<BR>
in res_odbc.conf<BR>
<BR>
enabled => yes<BR>
dsn => asterisk-connector<BR>
pre-connect => yes<BR>
<BR>
in odbc.ini<BR>
<BR>
[asterisk-connector]<BR>
Description = PostgreSQL connection to 'asterisk' database<BR>
Driver = PostgreSQL<BR>
Database = db_asterisk<BR>
Servername = localhost<BR>
UserName = asterisk<BR>
Password = secret<BR>
Port = 5432<BR>
Protocol = 9.1<BR>
ReadOnly = No<BR>
RowVersioning = No<BR>
ShowSystemTables = No<BR>
ShowOidColumn = No<BR>
FakeOidIndex = No<BR>
ConnSettings =<BR>
<BR>
<BR>
in odbcinst.ini<BR>
<BR>
[PostgreSQL]<BR>
Description = ODBC for PostgreSQL<BR>
Driver = /usr/lib/libodbcpsql.so<BR>
Setup = /usr/lib/libodbcpsql.so<BR>
FileUsage = 1<BR>
<BR>
if I run with root:<BR>
<BR>
#echo "select 1" | isql -v asterisk-connector<BR>
<BR>
returns <BR>
<BR>
+---------------------------------------+<BR>
| Connected! |<BR>
| |<BR>
| sql-statement |<BR>
| help [tablename] |<BR>
| quit |<BR>
| |<BR>
+---------------------------------------+<BR>
SQL> select 1<BR>
+------------+<BR>
| ?column? |<BR>
+------------+<BR>
| 1 |<BR>
+------------+<BR>
SQLRowCount returns 1<BR>
1 rows fetched<BR>
<BR>
This show me that it can connect, the thing is that in the asterisk logs it returns:<BR>
<BR>
res_odbc.c: Connecting asterisk<BR>
res_odbc.c: res_odbc: Error SQLConnect=-1 errno=101 [unixODBC]Could not connect to the server;<BR>
Could not connect to remote socket<BR>
res_odbc.c: Failed to connect to asterisk<BR>
res_odbc.c: Registered ODBC class 'asterisk' dsn->[asterisk-connector]<BR>
res_odbc.c: res_odbc loaded.<BR>
<BR>
I notice that if I run the isql command with other user than root, it returns <BR>
<BR>
[S1000][unixODBC]Could not connect to the server;<BR>
Could not connect to remote socket.<BR>
[ISQL]ERROR: Could not SQLConnect<BR>
<BR>
I guess is an extra configuration for ODBC that I am missing, what you think?<BR>
<BR>
Regards,<BR>
<BR>
On Fri, 2012-02-24 at 13:16 -0600, Jonathan Rose wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
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" <<A HREF="mailto:sbasurto@soft-gator.com">sbasurto@soft-gator.com</A>>
To: <A HREF="mailto:asterisk-users@lists.digium.com">asterisk-users@lists.digium.com</A>
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 <A HREF="http://www.api-digital.com">http://www.api-digital.com</A> --
New to Asterisk? Join us for a live introductory webinar every Thurs: <A HREF="http://www.asterisk.org/hello">http://www.asterisk.org/hello</A> asterisk-users mailing list
To UNSUBSCRIBE or update options visit: <A HREF="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</A>
        --
Sergio Basurto < <A HREF="mailto:sbasurto@soft-gator.com">sbasurto@soft-gator.com</A> >
Soft Gator S.A de C.V.
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by <A HREF="http://www.api-digital.com">http://www.api-digital.com</A> --
New to Asterisk? Join us for a live introductory webinar every Thurs:
<A HREF="http://www.asterisk.org/hello">http://www.asterisk.org/hello</A>
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
<A HREF="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</A>
</PRE>
</BLOCKQUOTE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
-- <BR>
Sergio Basurto <<A HREF="mailto:sbasurto@soft-gator.com">sbasurto@soft-gator.com</A>><BR>
Soft Gator S.A de C.V.
</TD>
</TR>
</TABLE>
<BR>
</BODY>
</HTML>