[Asterisk-Users] cdr_odbc with mysql on a remote server

Adam Goryachev mailinglists at websitemanagers.com.au
Wed May 26 21:34:10 MST 2004


On Wed, 2004-05-26 at 23:54, brian wrote:
> Its very clear why its not working. Visit www.voip-info.org for some
> examples on how to set it up.  If you didn't compile unixODBC and MyODBC
> from src then you will need to do so.  Installing via RPM or package has
> proven in the past to not work.
> 

Well, it is clear, it is trying to connect to the local socket instead
of the remote host. I did look at www.voip-info.org for information on
how to install it, and how to configure it. It was quite helpful. I
didn't use any RPM's, I compiled everything from source.

However, the details on the wiki all talk about using a local socket, I
couldn't find any example using mysql (or any other DB) on a remote
host.

I have correctly configure the odbc.ini file with the remote hostname
and port, but asterisk seems to ignore that. In fact, I have to wonder
why the cdr_odbc.conf requires the username/password settings when these
values are configured in the odbc.ini file already.

Contents of cdr_odbc.conf:
[global]
dsn=AsteriskCDR
username=asteriskcdr
password=yeahright
loguniqueid=yes

Contents of odbc.ini:
[AsteriskCDR]
Driver       = /usr/local/lib/libmyodbc3.so
Description  = MySQL ODBC 3.51 Driver DSN
SERVER       = mysql.websitemanagers.com.au
PORT         =
USER         = asteriskcdr
Password     = yeahright
Database     = phones
OPTION       = 3
SOCKET       =

Like I said, I didn't see anything in the cdr_odbc.c which suggested it
would support connecting to a remote server....

Then again, I am not expert.

Any assistance would be very much appreciated.

> > -----Original Message-----
> > From: asterisk-users-admin at lists.digium.com [mailto:asterisk-users-
> > admin at lists.digium.com] On Behalf Of Adam Goryachev
> > Sent: Wednesday, May 26, 2004 3:22 AM
> > To: asterisk-users at lists.digium.com
> > Subject: [Asterisk-Users] cdr_odbc with mysql on a remote server
> >
> > I'm trying to add cdr_odbc.so to log my CDR data to a mysql DB. I've
> > managed to compile everything, and seem to almost be ready to head home.
> > I've added a small debug line to cdr_odbc.c as follows:
> >         if((ODBC_res != SQL_SUCCESS) && (ODBC_res !=
> > SQL_SUCCESS_WITH_INFO))
> >         {
> >                 if(option_verbose > 10)
> >                         ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Error
> > SQLConnect %d\n", ODBC_res);
> >                 SQLGetDiagRec(SQL_HANDLE_DBC, ODBC_con, 1, ODBC_stat,
> > &ODBC_err, ODBC_msg, 100, &ODBC_mlen);
> > >>              if(option_verbose > 10)
> > >>                      ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Error
> > Details: %s\n", ODBC_msg);
> >                 SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
> >                 connected = 0;
> >                 return -1;
> >         }
> >
> > Lines marked with >> are lines I added. Here are the error messages I
> > get on the console:
> >
> > asterisk*CLI> load cdr_odbc.so
> >  Loaded /usr/lib/asterisk/modules/cdr_odbc.so => (ODBC CDR Backend)
> >   == Parsing '/etc/asterisk/cdr_odbc.conf':   == Parsing
> > '/etc/asterisk/cdr_odbc.conf': Found
> > 2004-05-26 18:13:54 NOTICE[6151]: cdr_odbc.c:336 odbc_load_module:
> > cdr_odbc: Logging uniqueid
> >        > cdr_odbc: dsn is AsteriskCDR
> >        > cdr_odbc: username is asteriskcdr
> >        > cdr_odbc: password is [secret]
> >        > cdr_odbc: Error SQLConnect -1
> >        > cdr_odbc: Error Details: [MySQL][ODBC 3.51 Driver]Can't connect
> > to local MySQL server through socket '/tmp/mysql.sock' (2)
> > 2004-05-26 18:13:54 ERROR[6151]: cdr_odbc.c:363 odbc_load_module:
> > cdr_odbc: Unable to connect to datasource: AsteriskCDR
> >        > cdr_odbc: Unable to connect to datasource: AsteriskCDR
> >
> > So, the problem I am having is that the mysql odbc driver seems to want
> > to use a local socket, but I am not running mysql locally on the
> > asterisk machine. I want it to connect to a remote host.
> >
> > I don't see anything in the source that indicates it can/should be able
> > to do this. Can someone either tell me it isn't possible, or I need to
> > hack the source, or it is already there and I am just blind...
> >
> > Thanks,
> > Adam
> >
> > _______________________________________________





More information about the asterisk-users mailing list