asterisk用 freetds记录 cdr 到mssql

        Compile, configure, and install the latest FreeTDS package:

  • [pre]           tar -zxvf freetds-0.62.4.tar.gz &&            cd freetds-0.62.4 &&            ./configure --prefix=/usr --with-tdsver=7.0            make &&            make install [/pre]

                Compile, or recompile, asterisk so that it will now add support                for cdr_tds.

  • [pre]                   make clean && ./configure --with-tds &&                    make update &&                    make &&                    make install [/pre]

                Only install one database connector.  Do not confuse asterisk                by using both ODBC (cdr_odbc) and FreeTDS (cdr_tds).                This command will erase the contents of cdr_odbc.conf

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

                Setup cdr_tds configuration files.  These are working samples                from my system.  You will need to modify for your setup. Define                your usernames and passwords here, secure file as well.

  • [pre]                /etc/asterisk/cdr_tds.conf            [global]            hostname=192.168.1.25            port=1433            dbname=voipdb            user=voipdbuser            password=voipdpass            charset=BIG5 [/pre]

                And finally, create the 'cdr' table in your mssql database.

  • [pre]        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] (150)         NULL ,                 [userfield]     [varchar] (256)         NULL         ) [/pre]

                Start asterisk in verbose mode, you should see that asterisk                logs a connection to the database and will now record every                call to the database when it's complete.

原文地址:https://www.cnblogs.com/noobkey/p/3225104.html