⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cdrdriver.tex

📁 asterisk 是一个很有知名度开源软件
💻 TEX
📖 第 1 页 / 共 2 页
字号:
Call data records can be stored in many different databases or even CSV text.\section{MSSQL}	Asterisk can currently store CDRs into an MSSQL database in	two different ways:  cdr\_odbc or cdr\_tds		Call Data Records can be stored using unixODBC (which requires	the FreeTDS package) [cdr\_odbc] or directly by using just the	FreeTDS package [cdr\_tds]  The following provide some	examples known to get asterisk working with mssql.	NOTE:  Only choose one db connector.\subsection{ODBC using cdr\_odbc}	Compile, configure, and install the latest unixODBC package:\begin{astlisting}\begin{verbatim}	tar -zxvf unixODBC-2.2.9.tar.gz &&	cd unixODBC-2.2.9 &&	./configure --sysconfdir=/etc --prefix=/usr --disable-gui &&	make &&	make install\end{verbatim}\end{astlisting}	Compile, configure, and install the latest FreeTDS package:\begin{astlisting}\begin{verbatim}	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\end{verbatim}\end{astlisting}	Compile, or recompile, asterisk so that it will now add support	for cdr\_odbc.\begin{astlisting}\begin{verbatim}	make clean && ./configure --with-odbc &&	make update &&	make &&	make install\end{verbatim}\end{astlisting}	Setup odbc configuration files.  These are working examples	from my system.  You will need to modify for your setup.	You are not required to store usernames or passwords here.\begin{astlisting}\begin{verbatim}	/etc/odbcinst.ini	   [FreeTDS]	   Description    = FreeTDS ODBC driver for MSSQL	   Driver         = /usr/lib/libtdsodbc.so	   Setup          = /usr/lib/libtdsS.so	   FileUsage      = 1	/etc/odbc.ini	   [MSSQL-asterisk]	   description         = Asterisk ODBC for MSSQL	   driver              = FreeTDS	   server              = 192.168.1.25	   port                = 1433	   database            = voipdb	   tds_version         = 7.0	   language            = us_english\end{verbatim}\end{astlisting}		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\_tds.conf\begin{astlisting}\begin{verbatim}		[ -f /etc/asterisk/cdr_tds.conf ] > /etc/asterisk/cdr_tds.conf\end{verbatim}\end{astlisting}		NOTE:  unixODBC requires the freeTDS package, but asterisk does		not call freeTDS directly.		Now set up cdr\_odbc 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.\begin{astlisting}\begin{verbatim}		/etc/asterisk/cdr_odbc.conf		   [global]		   dsn=MSSQL-asterisk		   username=voipdbuser		   password=voipdbpass		   loguniqueid=yes\end{verbatim}\end{astlisting}		And finally, create the 'cdr' table in your mssql database.\begin{astlisting}\begin{verbatim}		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		)\end{verbatim}\end{astlisting}		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.\subsection{TDS, using cdr\_tds}		Compile, configure, and install the latest FreeTDS package:\begin{astlisting}\begin{verbatim}		   tar -zxvf freetds-0.62.4.tar.gz &&		   cd freetds-0.62.4 &&		   ./configure --prefix=/usr --with-tdsver=7.0		   make &&		   make install\end{verbatim}\end{astlisting}                Compile, or recompile, asterisk so that it will now add support                for cdr\_tds.\begin{astlisting}\begin{verbatim}                   make clean && ./configure --with-tds &&                   make update &&                   make &&                   make install\end{verbatim}\end{astlisting}                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\begin{astlisting}\begin{verbatim}		[ -f /etc/asterisk/cdr_odbc.conf ] > /etc/asterisk/cdr_odbc.conf\end{verbatim}\end{astlisting}                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.\begin{astlisting}\begin{verbatim}                /etc/asterisk/cdr_tds.conf		   [global]		   hostname=192.168.1.25		   port=1433		   dbname=voipdb		   user=voipdbuser		   password=voipdpass		   charset=BIG5\end{verbatim}\end{astlisting}                And finally, create the 'cdr' table in your mssql database.\begin{astlisting}\begin{verbatim}		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 ,		        [userfield]     [varchar] (256)         NULL		)\end{verbatim}\end{astlisting}                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.\section{MYSQL}Using MySQL for CDR records is supported by using ODBC and the cdr\_odbc module.\section{PGSQL}        If you want to go directly to postgresql database, and have the cdr\_pgsql.so        compiled you can use the following sample setup.        On Debian, before compiling asterisk, just install libpqxx-dev.        Other distros will likely have a similiar package.        Once you have the compile done,        copy the sample cdr\_pgsql.conf file or create your own.        Here is a sample:\begin{astlisting}\begin{verbatim}        /etc/asterisk/cdr_pgsql.conf          ; Sample Asterisk config file for CDR logging to PostgresSQL          [global]          hostname=localhost          port=5432          dbname=asterisk          password=password          user=postgres          table=cdr\end{verbatim}\end{astlisting}        Now create a table in postgresql for your cdrs\begin{astlisting}\begin{verbatim}        CREATE TABLE cdr (                calldate      time               NOT NULL ,                clid          varchar (80)          NOT NULL ,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -