linux搭建VOIP

安装Asterisk

首先在http://www.Asterisk.org/downloadAsterisk Version 1.2.6(Zaptel Version 1.2.5Libpri Version 1.2.2Addons Version 1.2.2Sounds Version 1.2.1 
//安装Zaptel #tar zxvf Zaptel*.tar.gz#cd Zaptel-1.2.5#make clean#make linux26 //如果linux系统使用的是2.6的内核就加这一步#make install//安装Asterisk#tar zxvf Asterisk-1.2.6.tar.gz#cd Asterisk-1.2.6#make #make install#make sample //安装例子#make progdocs//安装文档#modprobe zaptel//安装声音配置文件#tar zxvf Asterisk-sounds-1.2.1.tar.gz#cd Asterisk-sounds-1.2.1#make clean#make //什么也不做,可以不用#make install
配置文件添加用户编辑/etc/asterisk /sip.conf#vi /etc/asterisk/sip.conf添加用户[5000]和[5001][5000]

type=friendusername=5000host=dynamiccontext=default(context的参数要对应extensions.conf中的设置)canreinvite=yesdtmfmode=rfc2833
[5001]type=friendusername=5001host=dynamiccontext=defaultcanreinvite=yesdtmfmode=rfc2833修改/etc/asterisk/extensions.conf(负责拨号规则等配置)的default段修改成如下:在文件的最后改成[default]include => demo //包含DEMO模块中的配置exten => _5XXX,1,Dial(SIP/${EXTEN},15,t) //允许拨叫5***类型的号码exten => _5XXX,3,Hangup保存后重启asterisk# asterisk ?vvcg //以控制台方式启动asterisk服务
若已经启动可先停下来
*CLI>stop now(*CLI>是在ASTERISK控制台状态下的命令行提示符号)或者
*CLI>reload
客户端配置
我们选的是SIP PHONE
在设置中添加
帐号:5000
密码:5000
服务器:IP Address
这样双方便可以通话了,但音质不好,有一定延时
装了asterisk-sounds-1.2.1后,音质有很大提高,但仍存在不稳定的问题,但客户端与服务器之间通话质量可以保证,尤其是服务器端收听到的音质异常清晰

Asterisk单口E1/T1中继线接口卡

Zapdat安装好之后,需手动加载E1卡的驱动才行,可将其加入到/etc/rc.local内开机时自动加载。加载方法为:

Modprobe zaptelModprobe wct4xxp(TE210P)? 或 wctel1xp(TEL10P) //使用WCT4XXP或者WCTE11XP具体看卡的型号

配置相关参数需编辑/etc/zaptel.conf (使用TEL10P卡时“[]”内容不需要)span=1,1,0,ccs,hdb3,crc4[span=2,2,0,ccs,hdb3,yellow]bchan=1-15,17-31[,32-46,48-62] \\配置中继线接口卡中的B信道dchan=16[,47] \\配置中继线接口卡中的D信道loadzone=cn \\区域名defaultzone=cn

配置/etc/asterisk/zapata.conf:1) 屏蔽中间下面这行的配置signalling=fxo_ls2) 取消文件末尾处下列几行注释符号;switchtype = euroisdnsignalling = pri_net (或pri_cpe,两台必须配置不同以便实现双机直接互联)group = 1channel => 1-15,17-31[,32-46,47-62] (TEL10P卡不用配置“[]”内的内容)配好后可用ztcfg ?cvvvg看看有没有什么错误。安装 APACHE+PHP+PHPMYADMIN使用WEB页面管理MYSQL数据库

安装APACHE

Tar vzxf apache-1.3_20060604101640.tar.gz

Cd apache-1.3

./configure –prefix=/fancy/apache –enable-module=so –enable-module=rewrite –enable-shared=max –htdocsdir=/fancy/www (指定安装路径)

MAKE

MAKE INSTALL

/fancy/apache/bin/apachectl start(启动apache服务)

在IE上打开测试地址HTTP://Server IP Address检查APACHE服务是否正常

安装PHP4

tar vzxf php-4.4.3RC1.tar.gz

./configure \

–prefix=/fancy/php \

–enable-force-cgi-redirect \

–with-gd –enable-gd-native-ttf \

–with-ttf \

–with-gdbm \

–with-gettext \

–with-iconv \

–with-png \

–with-zlib \

–with-xml \

–enable-calendar \

–with-apxs=/fancy/apache/bin/apxs(如果MAKE时出错,则去掉这一句)

Make

Make install

把php的配置文件拷贝到相应的目录下

  cd ../php

  cp php.ini-dist /usr/local/lib/php.ini

  php.ini基本可以不用作什么修改,要修改可以参照相应的说明。

在PHP.INI中 添加

;extension=php_xslt.dll

;extension=php_yaz.dll

;extension=php_zip.dll

extension=/usr/lib/php4/ldap.so(添加这一条使PHP支持LDAP)

 配置完PHP就该配置Apache Web SERVER了,先对httpd.conf进行配置

  cd /usr/local/apache/conf

  vi httpd.conf

在这里能看到LODMODEM。并且在LIBEXEC 目录中有MOD文件。

  针对php要对以下内容进行修改:

  # AddType application/x-httpd-php .php

  # AddType application/x-httpd-php-source .phps

然后写个php测试页info.php:内容如下

<?php

phpinfo();

?>

正常的话,应该能看到php的信息了,恭喜你的Apche+Mysql+PHP安装成功。

PHPMYADMIN(MYsql web管理工具)配置

Cd /fancy/www/php/ libraries/

Vi config.defaule.php

修改如下部分

$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’; // 验证方式 (config, http 或者cookie,从安全性考虑建议使用HTTP)

$cfg[‘Servers’][$i][‘user’] = ‘test’; // MySQL user

$cfg[‘Servers’][$i][‘password’] = ‘*******’; // MySQL password (only needed

// with ‘config’ auth_type)

.登入时如果出现

1251 – Client does not support authentication protocol requested by server; consider upgrading MySQL client”

造成这个问题的原因是:如果你升级mysql到4.1以上版本后遇到以上问题,请先确定你的mysql client 是4.1或者更高版本.

解决方法
mysql>SET PASSWORD FOR ->’some_user’@’some_host’=OLD_PASSWORD(‘newpwd’);

实例:mysql数据库用户名为’abc’,密码为’123456’,则按上面例子在服务器mysql命令行窗口中实际实施的语句如下: mysql>SET PASSWORD FOR ->’abc’@’localhost’=OLD_PASSWORD(‘123456’);

安装a2billing软件使用WEB管理ASTERISK

Tar ?vzxf Asterisk2Billing_release_Chameleon_v1_2_3[1].tar.gz

Cd Asterisk2Billing_release_Chameleon_v1_2_3[1]

./install.sh

1-. A2Billing_UI

2-. A2BCustomer_UI

3-. A2Billing_AGI

4-. Exit

导入数据库

Cd Asterisk2Billing_release_Chameleon_v1_2_3[1]/Database/mysql/ Mysql-5.x

Mysql ?u root ?p <

mysql -u root -p < a2billing-MYSQL-createdb-user.sql

查看MYSQL数据库中增加 了Mya2billing数据库

mysql -u root -p mya2billing < a2billing-mysql-schema-MYSQL.5.X-v1.2.3.sql

查看MYSQL数据库中增的Mya2billing库中增加了31个表

分别选择1,2,3安装A2BILLING

配置A2billing

Vi /etc/asterisk/ a2billing.conf

[database]

hostname=localhost

port=5432

user=root

password=********

dbname=mya2billing

;dbtype=postgres

dbtype=mysql

将SIP用户写到MYSQL数据库中

编辑/etc/asterisk/extconfig.conf添加

sipusers => mysql,mya2billing,cc_sip_buddies(分别指定数据库类型,数据库名,数据库表名)

sippeers => mysql,mya2billing,cc_sip_buddies

修改res_mysql.conf配置SIP连接MYSQL的参数

[general]

dbhost = localhost

dbname = mya2billing

dbtable = cc_sip_buddies

dbuser = root

dbpass = ********

dbport = 3306

;dbsock = /tmp/mysql.

dbsock=/var/lib/mysql/mysql.sock

配置记费软件

编辑cdr_mysql.conf添加记费软件写入的数据库和表名

[global]

hostname=localhost

dbname=billing

table=cdr

user=root

password=********

;port=3306

;sock=/tmp/mysql.sock

;userfield=1

sock=/var/lib/mysql/mysql.sock


生命不息,在任何一种博大的辉煌之后,都掩藏着许多鲜为人知的艰难的奋斗。

linux搭建VOIP

相关文章:

你感兴趣的文章:

标签云: