1.简介asterisk-TG
Asterisk-TG是在开源软件Asterisk的基础上,针对媒体网关需求,修改了SIP协议部分处理流程代码,而形成的一套软件。由于做媒体网关的需求和Asterisk原始做PBX需求不完全相同,因此代码不兼容Asterisk。不能使用Asterisk的源代码包进行替换。
Asterisk-TG是一个标准的媒体网关,支持SIP、PRI、ISUP信令。硬件使用标准的PC服务器+OpenVox板卡的方案。单机最大支持2*D410E板卡,一共支持8 E1共240路电路接入。
asterisk-TG的组成模块:
asterisk-TG的使用:
2.硬件支持:
一台pc机 ,CPU要求为2.8Ghz以上的Intel双核处理器,2G物理内存
一个1E1的信令卡
3.软件系统支持
安装linux操作系统CentOS
环境变量LANG=en_US.UTF-8,配置在文件/etc/sysconfig/i18n
4.安装asterisk-TG系统:
新建账户asterisk-TG(useradd),把四个安装包通过ftp传到该账户下,这四个安装包是:
dahdi-linux-complete-2.2.0.2+2.2.0-withoslec.tar.gz
libpri-1.4.10.tar.gz
asterisk-1.4.26-TG-1.0.1.tar.gz
chan_ss7-1.3.tar.gz
以下操作都是在root账户下
(1)首先装newt工具包:
yum install newt-devel
yum install newt
(2)DAHDI安装
在/home/asterisk-TG目录下
tar zxvf dahdi-linux-complete-2.2.0.2+2.2.0-withoslec.tar.gz
cd dahdi-linux-complete-2.2.0.2+2.2.0-withoslec
make
make install
make config
cd ..
查看是否安装好,启动命令/etc/init.d/dahdi start,能启动起来表明已经安装好
可以使用命令dahdi_tool查看硬件板卡的信息和状态。
然后/etc/init.d/dahdi stop
(3)LibPRI安装
tar zxvf libpri-1.4.10.tar.gz
cd libpri-1.4.10
make
make install
/sbin/ldconfig -n /usr/lib
cd ..
(4)Asterisk-TG安装
tar zxvf asterisk-1.4.26-TG-1.0.1.tar.gz
cd asterisk-1.4.26-TG
./configure
make
make install
make samples
make config
cd ..
(5)chan-ss7安装
当使用ISUP的使用才使用ss7处理模块
tar zxvf chan_ss7-1.3.tar.gz
cd chan_ss7-1.3
make
make install
cd ..
注:若使用ISUP,则要把chan_ss7.so复制到/usr/lib/asterisk/modules/目录下。
5.设置配置文件
(1)/etc/dahdi/system.conf 板卡信息配置
[root@localhost ~]# cat /etc/dahdi/system.conf
span=1,1,0,ccs,hdb3
bchan=1-15,17-31
dchan=16
echocanceller=none //消除回声
loadzone =cn
defaultzone =cn
一个span对应一个E1话路,第一个1表示E1编号,第二个1表示时钟源为主,ccs是frame格式,hdb3是编码格式;
bchan:话路,数据通道,30个时隙
dchan:信令,分组信息通道,第16时隙
(2)/etc/asterisk/chan_dahdi.conf PRI协议模块的参数配置
[root@localhost ~]# cat /etc/asterisk/chan_dahdi.conf
[trunkgroups]
[channels]
context=from_pri //与extensions.conf中的from_pri对应
switchtype = euroisdn //交换机类型,说明PRI信令采用欧洲标准
;switchtype = national
;pridialplan=national
signalling = pri_cpe //信令类型,用户侧;pri_net表示网络侧
;pri_net:net, pri_cpe:user
group=1
channel => 1-15,17-31 把这个E1的30条话路分到分组1
echocancel=no
echocancelwhenbridged=no
(3)/etc/asterisk/sip.conf SIP协议模块处理部分
[root@localhost ~]# cat /etc/asterisk/sip.conf
[general]
context=from_sip
allowguest=yes
allowoverlap=yes
allowtransfer=no
bindport=5050
bindaddr=0.0.0.0
srvlookup=yes
disallow=all
allow=alaw
dtmfmode=inband
;dtmfmode=auto
language=cn
progressinband=never
useragent=Asterisk-TG
callevents=yes
limitonpeers=no
canreinvite=yes
;jbenable = yes
[s1] //软交换设置
type=friend
context=from_sip
host=192.168.2.215
port=5060
fromdomain=192.168.2.215
insecure=port,invite
progressinband=never
qualify=yes
disallow=all
allow=alaw
dtmfmode=inband
;dtmfmode=auto
(4)/etc/asterisk/rtp.conf RTP端口配置
[root@localhost ~]# cat /etc/asterisk/rtp.conf
[general]
rtpstart=10000
rtpend=13999
注:Asterisk-TG网关把pri消息转换为sip消息,语音流转换为RTP流,发送sip消息的端口设置为5050,RTP流的端口为1000~13999
(5)/etc/asterisk/ss7.conf ISUP协议配置
[linkset-g1]
enabled => yes
enable_st => no
use_connect => no
hunting_policy => even_mru
subservice => auto
variant => CHINA
context => from_pstn
language => cn
t35 => 15000,timeout
[link-l1]
linkset => g1
channels => 1-15,17-31
schannel => 16 :传信令的时隙
firstcic => 1
enabled => yes
[host-minicc]
enabled => yes
opc => 0x010101
dpc => g1:0x020202
links => l1:1 :l1对应span1
;if-1 => 192.168.2.215
注:当使用isup协议的时候才会配置该文件,否则置为空。若使用isup,chan_dahdi.conf置为空。
(6)/etc/asterisk/extensions.conf 配置如何转接PRI或ISUP和SIP
[root@localhost ~]# cat /etc/asterisk/extensions.conf
[globals]
[general]
autofallthrough=yes
[default]
[from_sip]
exten =>_X.,1,Dial(DAHDI/g1/${EXTEN:0}) ;将sip的呼叫都用PRI信令转接到g1,g1在chan_dahdi.conf中配置
;exten =>_X.,1,Dial(SS7/g1/${EXTEN:0}):将sip的呼叫都用ISUP信令转接到g1,g1在ss7.conf中配置
[from_pstn]
exten =>_X.,1,ChanIsAvail(SIP/s1&SIP/s2):将pstn的呼叫都用SIP协议转接到s1;s1在sip.conf中配置
exten =>_X.,2,Dial(${CUT(AVAILCHAN||1)}/${EXTEN:0})
;exten =>_X.,1,Dial(SIP/s1/${EXTEN:0})
(7)/etc/asterisk/http.conf 配置http管理
[general]
enabled=yes
bindaddr=0.0.0.0 http管理绑定ip为本机ip
bindport=8088 绑定端口
6.软件系统启动与关闭
配置好以后就可以启动系统:
service dahdi start 先启动板卡驱动
asterisk –cvvvvv 手动启动asterisk,可以查看每个模块是否都启动。一般安装好后第一次启动的时候用这个命令
service asterisk start :以后启动用这个命令
关闭系统:
service asterisk stop :先关闭asterisk
service dahdi stop :关闭板卡驱动
注:启动关闭系统的这个顺序不能更改,否则会报错
7.进入asterisk命令行界面
网关启动后,使用命令asterisk -r进入asterisk命令行
使用help命令可以查看asterisk命令。
pri show spans命令
localhost*CLI> pri show spans
PRI span 1/0: Provisioned, Up, Active,说明有一个span,即一个E1,状态为up,说明网关可以使用了