[Asterisk-Users] MS SQL & Free TDS

Duane Cox duanec at mail.illicom.net
Wed Jul 28 15:51:57 MST 2004


Sure thing... 

Luke Catranis, Seshu Kanuri, and any others:


Asterisk CVS-HEAD, CDR with MSSQL 7.0 database; via unixODBC and FreeTDS:

cd /usr/src &&
rm -fr unixODBC-2.2.9 &&
tar -zxvf unixODBC-2.2.9.tar.gz &&
cd unixODBC-2.2.9 &&
./configure --sysconfdir=/etc --prefix=/usr --disable-gui &&
make &&
make install

cd /usr/src &&
rm -fr freetds-0.62.4 &&
tar -zxvf freetds-0.62.4.tar.gz &&
cd freetds-0.62.4 &&
./configure --prefix=/usr --with-tdsver=7.0 --with-unixodbc=/usr/lib &&
make &&
make install

ldconfig -v

/etc/rc.d/init.d/asterisk stop

cd /usr/src/asterisk &&
make clean &&
make update &&
make &&
make install

cat > /etc/odbcinst.ini << "EOF"
[FreeTDS]
Description    = FreeTDS ODBC driver for MSSQL
Driver         = /usr/lib/libtdsodbc.so
Setup          = /usr/lib/libtdsS.so
FileUsage      = 1
EOF

cat > /etc/odbc.ini << "EOF"
[MSSQL-asterisk]
description         = Asterisk ODBC for MSSQL
driver              = FreeTDS
server              = IP.IP.IP.IP
port                = 1433
database            = your_database_name_here
tds_version         = 7.0
language            = us_english
EOF

[ -f /etc/asterisk/cdr_tds.conf ] > /etc/asterisk/cdr_tds.conf

cat > /etc/asterisk/cdr_odbc.conf << "EOF"
[global]
dsn=MSSQL-asterisk
username=your_sql_username_here
password=your_sql_password_here
loguniqueid=yes
EOF

cat > cdr_table.sql << "EOF"
CREATE TABLE cdr ( 
        [calldate]      [datetime]              NOT NULL ,
        [clid]          [varchar] (80)          NOT NULL ,
        [src]           [varchar] (80)          NOT NULL ,
        [dst]           [varchar] (80)          NOT NULL ,
        [dcontext]      [varchar] (80)          NOT NULL ,
        [channel]       [varchar] (80)          NOT NULL ,
        [dstchannel]    [varchar] (80)          NOT NULL ,
        [lastapp]       [varchar] (80)          NOT NULL ,
        [lastdata]      [varchar] (80)          NOT NULL ,
        [duration]      [int]                   NOT NULL ,
        [billsec]       [int]                   NOT NULL ,
        [disposition]   [varchar] (45)          NOT NULL ,
        [amaflags]      [int]                   NOT NULL ,
        [accountcode]   [varchar] (20)          NOT NULL ,
        [uniqueid]      [varchar] (32)          NOT NULL ,
        [userfield]     [varchar] (255)         NOT NULL
)
GO
EOF

echo "modify for your IP, database, username, and password"

/etc/rc.d/init.d/asterisk start




Asterisk CVS-HEAD, CDR with MSSQL 7.0 database; via FreeTDS directly (I like better):

cd /usr/src &&
rm -fr freetds-0.62.4 &&
tar -zxvf freetds-0.62.4.tar.gz &&
cd freetds-0.62.4 &&
./configure --prefix=/usr --with-tdsver=7.0 &&
make &&
make install

ldconfig -v

/etc/rc.d/init.d/asterisk stop

cd /usr/src/asterisk &&
make clean &&
make update &&
make &&
make install

[ -f /etc/asterisk/cdr_odbc.conf ] > /etc/asterisk/cdr_odbc.conf

cat > /etc/asterisk/cdr_tds.conf << "EOF"
[global]
hostname=IP.IP.IP.IP
port=1433
dbname=your_database_name_here
user=your_sql_username_here
password=your_sql_password_here
charset=BIG5
EOF

cat > cdr_table.sql << "EOF"
CREATE TABLE cdr (
        [accountcode]   [varchar] (20)          NULL ,
        [src]           [varchar] (80)          NULL ,
        [dst]           [varchar] (80)          NULL ,
        [dcontext]      [varchar] (80)          NULL ,
        [clid]          [varchar] (80)          NULL ,
        [channel]       [varchar] (80)          NULL ,
        [dstchannel]    [varchar] (80)          NULL ,
        [lastapp]       [varchar] (80)          NULL ,
        [lastdata]      [varchar] (80)          NULL ,
        [start]         [datetime]              NULL ,
        [answer]        [datetime]              NULL ,
        [end]           [datetime]              NULL ,
        [duration]      [int]                   NULL ,
        [billsec]       [int]                   NULL ,
        [disposition]   [varchar] (20)          NULL ,
        [amaflags]      [varchar] (16)          NULL ,
        [uniqueid]      [varchar] (32)          NULL
)
GO
EOF

echo "modify for your IP, database, username, and password"

/etc/rc.d/init.d/asterisk start




Duane Cox


  ----- Original Message ----- 
  From: Kanuri, Seshu 
  To: asterisk-users at lists.digium.com 
  Cc: duanec at mail.illicom.net 
  Sent: Wednesday, July 28, 2004 3:55 PM
  Subject: RE: [Asterisk-Users] MS SQL & Free TDS


  Duane,

  Can you please Post your Config files and any Steps necessary to make a clean install, for the benefit of everyone.

  Thanks

  Seshu Kanuri
    -----Original Message-----
    From: asterisk-users-admin at lists.digium.com [mailto:asterisk-users-admin at lists.digium.com]On Behalf Of Duane Cox
    Sent: Wednesday, July 28, 2004 2:34 PM
    To: asterisk-users at lists.digium.com
    Subject: Re: [Asterisk-Users] MS SQL & Free TDS


    I've had both cdr_odbc.c and cdr_tds.c working with MSSQL

    What kind of specific problem are you having, we can get it working.



      ----- Original Message ----- 
      From: Luke Catranis 
      To: asterisk-users at lists.digium.com 
      Sent: Wednesday, July 28, 2004 10:16 AM
      Subject: [Asterisk-Users] MS SQL & Free TDS


      Help!
      I've been using mysql for cdr storage, I need to switch to MS SQL. I must be
      stupid or something but I cannot figure out how to setup the cdr_tds. I have
      FreeTDS configured properly, but my unixodbc is not working properly
      either... I'd be happy with either solution, but I'm in need of assistance.


      Luke Catranis

      _______________________________________________
      Asterisk-Users mailing list
      Asterisk-Users at 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

  ----- Original Message ----- 
  From: Kanuri, Seshu 
  To: asterisk-users at lists.digium.com 
  Cc: duanec at mail.illicom.net 
  Sent: Wednesday, July 28, 2004 3:55 PM
  Subject: RE: [Asterisk-Users] MS SQL & Free TDS


  Duane,

  Can you please Post your Config files and any Steps necessary to make a clean install, for the benefit of everyone.

  Thanks

  Seshu Kanuri
    -----Original Message-----
    From: asterisk-users-admin at lists.digium.com [mailto:asterisk-users-admin at lists.digium.com]On Behalf Of Duane Cox
    Sent: Wednesday, July 28, 2004 2:34 PM
    To: asterisk-users at lists.digium.com
    Subject: Re: [Asterisk-Users] MS SQL & Free TDS


    I've had both cdr_odbc.c and cdr_tds.c working with MSSQL

    What kind of specific problem are you having, we can get it working.



      ----- Original Message ----- 
      From: Luke Catranis 
      To: asterisk-users at lists.digium.com 
      Sent: Wednesday, July 28, 2004 10:16 AM
      Subject: [Asterisk-Users] MS SQL & Free TDS


      Help!
      I've been using mysql for cdr storage, I need to switch to MS SQL. I must be
      stupid or something but I cannot figure out how to setup the cdr_tds. I have
      FreeTDS configured properly, but my unixodbc is not working properly
      either... I'd be happy with either solution, but I'm in need of assistance.


      Luke Catranis

      _______________________________________________
      Asterisk-Users mailing list
      Asterisk-Users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20040728/34eb5236/attachment.htm


More information about the asterisk-users mailing list