在Asterisk 1.6 上安装TE110P

所谓五分钟热度或者热情澎湃大概描述的就是我.在Asterisk1.6上安装X100P的成功,让我领略到了VoIP-PSTN的美妙,也促使我想进一步尝试更加企业级的T1/E1-VoIP的念头.说做就做,马上去淘宝上买了一块TE110P,装上电脑,马上安装起来.
注意,本文是在在Asterisk1.6上安装X100P的基础上进行的,所以没有完整的安装过程,只有每个步骤的结果和错误的总结.有问题的可以参考前文.


Step 1 硬件安装
这次学乖了.先从底层硬件驱动开始安装.开机以后直接运行dahdi_cfg,结果如下.

$ dahdi_cfg -vv
DAHDI Tools Version - 2.2.0
Notice: Configuration file is /etc/dahdi/system.conf
line 0: Unable to open master device '/dev/dahdi/ctl'
1 error(s) detected

运行asterisk,察看dahdi的status和channels情况,结果如下.

*CLI> dahdi show status
Description Alarms IRQ bpviol CRC4 Fra Codi Options LBO
Digium Wildcard TE110P T1/E1 Card 0 UNCONFI 0 0 0 CAS Unk YEL 0 db (CSU)/0-133 feet (DSX-1)
*CLI> dahdi show channels
Chan Extension Context Language MOH Interpret Blocked State
pseudo default default In Service

基本情况完全一样,除了dahdi show status显示的板卡名称变成了Digium Wildcard TE110P T1/E1 Card(娃哈哈,企业级啊-,-b).
需要注意的是这台机器我成功的安装了DAHDI Complete,所以/etc/dahdi/modules的内容略有不同,所有的板卡代号都有,具体如下.

bash$ cat /etc/dahdi/modules
# Contains the list of modules to be loaded / unloaded by /etc/init.d/dahdi.
#
# NOTE: Please add/edit /etc/modprobe.d/dahdi or /etc/modprobe.conf if you
# would like to add any module parameters.
#
# Format of this file: list of modules, each in its own line.
# Anything after a '#' is ignore, likewise trailing and leading
# whitespaces and empty lines.
# Digium TE205P/TE207P/TE210P/TE212P: PCI dual-port T1/E1/J1
# Digium TE405P/TE407P/TE410P/TE412P: PCI quad-port T1/E1/J1
# Digium TE220: PCI-Express dual-port T1/E1/J1
# Digium TE420: PCI-Express quad-port T1/E1/J1
wct4xxp
# Digium TE120P: PCI single-port T1/E1/J1
# Digium TE121: PCI-Express single-port T1/E1/J1
# Digium TE122: PCI single-port T1/E1/J1
wcte12xp
# Digium T100P: PCI single-port T1
# Digium E100P: PCI single-port E1
wct1xxp
# Digium TE110P: PCI single-port T1/E1/J1
wcte11xp
# Digium TDM2400P/AEX2400: up to 24 analog ports
# Digium TDM800P/AEX800: up to 8 analog ports
# Digium TDM410P/AEX410: up to 4 analog ports
wctdm24xxp
# X100P - Single port FXO interface
# X101P - Single port FXO interface
wcfxo
# Digium TDM400P: up to 4 analog ports
wctdm
# Digium B410P: 4 NT/TE BRI ports
wcb4xxp
# Digium TC400B: G729 / G723 Transcoding Engine
wctc4xxp
# Xorcom Astribank Devices
xpp_usb

修复Error的方法照旧,将/etc/modprobe.d/dahdi.blacklist中wcte11xp那行去掉,重新运行/etc/init.d/dahdi,结果如下.

xiuxiu@sh-c2-pc:/etc/dahdi$ sudo /etc/init.d/dahdi start
Loading DAHDI hardware modules:
WARNING: All config files need .conf: /etc/modprobe.d/dahdi.blacklist, it will be ignored in a future release.
WARNING: All config files need .conf: /etc/modprobe.d/dahdi, it will be ignored in a future release.
wct4xxp: done wcte12xp: done wct1xxp: done wcte11xp: done wctdm24xxp: done wcfxo: done wctdm: done wcb4xxp: done wctc4xxp: done xpp_usb: done
Running dahdi_cfg: done.
xiuxiu@sh-c2-pc:/etc/dahdi$ sudo dahdi_cfg -vv
DAHDI Tools Version - 2.2.0
DAHDI Version: 2.2.0.2
Echo Canceller(s): MG2
Configuration
======================
SPAN 1: CCS/HDB3 Build-out: 0 db (CSU)/0-133 feet (DSX-1)
Channel map:
Channel 01: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 01)
Channel 02: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 02)
Channel 03: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 03)
Channel 04: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 04)
Channel 05: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 05)
Channel 06: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 06)
Channel 07: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 07)
Channel 08: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 08)
Channel 09: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 09)
Channel 10: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 10)
Channel 11: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 11)
Channel 12: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 12)
Channel 13: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 13)
Channel 14: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 14)
Channel 15: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 15)
Channel 16: D-channel (Default) (Echo Canceler: none) (Slaves: 16)
Channel 17: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 17)
Channel 18: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 18)
Channel 19: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 19)
Channel 20: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 20)
Channel 21: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 21)
Channel 22: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 22)
Channel 23: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 23)
Channel 24: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 24)
Channel 25: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 25)
Channel 26: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 26)
Channel 27: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 27)
Channel 28: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 28)
Channel 29: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 29)
Channel 30: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 30)
Channel 31: Clear channel (Default) (Echo Canceler: mg2) (Slaves: 31)
31 channels to configure.
Setting echocan for channel 1 to mg2
Setting echocan for channel 2 to mg2
Setting echocan for channel 3 to mg2
Setting echocan for channel 4 to mg2
Setting echocan for channel 5 to mg2
Setting echocan for channel 6 to mg2
Setting echocan for channel 7 to mg2
Setting echocan for channel 8 to mg2
Setting echocan for channel 9 to mg2
Setting echocan for channel 10 to mg2
Setting echocan for channel 11 to mg2
Setting echocan for channel 12 to mg2
Setting echocan for channel 13 to mg2
Setting echocan for channel 14 to mg2
Setting echocan for channel 15 to mg2
Setting echocan for channel 16 to none
Setting echocan for channel 17 to mg2
Setting echocan for channel 18 to mg2
Setting echocan for channel 19 to mg2
Setting echocan for channel 20 to mg2
Setting echocan for channel 21 to mg2
Setting echocan for channel 22 to mg2
Setting echocan for channel 23 to mg2
Setting echocan for channel 24 to mg2
Setting echocan for channel 25 to mg2
Setting echocan for channel 26 to mg2
Setting echocan for channel 27 to mg2
Setting echocan for channel 28 to mg2
Setting echocan for channel 29 to mg2
Setting echocan for channel 30 to mg2
Setting echocan for channel 31 to mg2

OK.到了这里硬件驱动安装部分就应该没问题了.

Step 2 配置Asterisk
因为换了一台机器,所以需要在chan_dahdi.conf中加入如下语句.

#include dahdi-channels.conf

重新运行asterisk,察看结果.

*CLI> dahdi show status
Description Alarms IRQ bpviol CRC4 Fra Codi Options LBO
Digium Wildcard TE110P T1/E1 Card 0 RED 1 0 0 CCS HDB3 CRC4 0 db (CSU)/0-133 feet (DSX-1)
*CLI> dahdi show channels
Chan Extension Context Language MOH Interpret Blocked State
pseudo default default In Service
1 from-pstn default In Service
2 from-pstn default In Service
3 from-pstn default In Service
4 from-pstn default In Service
5 from-pstn default In Service
6 from-pstn default In Service
7 from-pstn default In Service
8 from-pstn default In Service
9 from-pstn default In Service
10 from-pstn default In Service
11 from-pstn default In Service
12 from-pstn default In Service
13 from-pstn default In Service
14 from-pstn default In Service
15 from-pstn default In Service
17 from-pstn default In Service
18 from-pstn default In Service
19 from-pstn default In Service
20 from-pstn default In Service
21 from-pstn default In Service
22 from-pstn default In Service
23 from-pstn default In Service
24 from-pstn default In Service
25 from-pstn default In Service
26 from-pstn default In Service
27 from-pstn default In Service
28 from-pstn default In Service
29 from-pstn default In Service
30 from-pstn default In Service
31 from-pstn default In Service
*CLI>

OK了.到了这里Te110P的E1 PRI线路就通了.你可以配置自己的dial plan,然后修改dahdi-channels.conf中的配置来导入E1线路.Oh yeah~
问题总结
1.无法拨通,Asterisk本身没有debug信息.察看log,发现

ERROR[2077] chan_dahdi.c: Unknown signalling method 'pri_cpe' at line 14.

解决方案:主要原因是你的libpri没有安装好.重新下一个最新的libpri版本重新编译安装,应该就会好.


2.Asterisk有debug信息.但是无法默认接入Default Dialplan,听到”Welcome…”的语音.
主要是被X100P宠坏了,认为就应该直接可以拨入default的dialplan. 修改/etc/asterisk/dahdi-channels.conf,将context从from-pstn修改成default就可以了.

 

在Asterisk1.6上安装X100P

玩Asterisk有一段时间了,于是想在ethernet的基础上接触一下Analog, T1/E1方面的内容,也算是对本身工作的一种补充.
X100P是Asterisk入门级的FXO卡(其实就是最便宜板型中最便宜的一款-,-),热血沸腾了一把就在淘宝上花了100元买了一块.
网上X100P安装配置的文章很多,不过大多数都是基于Asterisk1.4之前的版本,使用Zaptel.而Asterisk之后使用的是DAHDI,所以配置上有一些差异,这让我着实费了一些功夫,也让我决心把我的安装过程写下来.
DAHDI与Zaptel配置文件的对应关系

/etc/zaptel.conf <-> /etc/dahdi/system.conf
/etc/asterisk/zapata.conf <-> /etc/asterisk/chan_dahdi.conf

Step 0 前提
软件要求:

sudo apt-get install cvs make gcc g++ libncurses5-dev libssl-dev zlib1g-dev make build-essential libxml2-dev

硬件要求:当然是把X100P插好咯.-,-


Step 1 安装libpri

wget http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.10.2.tar.gz
tar zxvf libpri-1.4.10.2.tar.gz
cd libpri-1.4.10.2
sudo make; sudo make install

Step 2 安装DAHDI Linux 和 DAHDI Tools

wget http://downloads.asterisk.org/pub/telephony/dahdi-linux/releases/dahdi-linux-2.2.1.tar.gz
tar zxvf dahdi-linux-2.2.1.tar.gz
cd dahdi-linux-2.2.1
sudo make;sudo make install


wget http://downloads.asterisk.org/pub/telephony/dahdi-tools/releases/dahdi-tools-2.2.1.tar.gz
tar zxvf dahdi-tools-2.2.1.tar.gz
cd dahdi-tools-2.2.1
sudo make;sudo make install
sudo make config

这步作完系统会提示发现DAHDI设备

install -D dahdi.init /etc/init.d/dahdi
/usr/sbin/update-rc.d dahdi defaults 15 30
System start/stop links for /etc/init.d/dahdi already exist.
DAHDI has been configured.
List of detected DAHDI devices:
pci:0000:01:02.0 wcfxo+ 1057:5608 Wildcard X100P
run 'dahdi_genconf modules' to load support for only
the DAHDI hardware installed in this system. By
default support for all DAHDI hardware is loaded at
DAHDI start.

Step 3 运行dahdi_genconf
上一步作完以后提示你运行这个命令.这也是dahdi和zaptel的一个比较大的不同.在dahdi中,dahdi_genconf会根据侦测到的dahdi设备自动为你进行配置.涉及到的配置文件包括以下几个.


/etc/dahdi/modules

# Autogenerated by /usr/sbin/dahdi_genconf (Dahdi::Config::Gen::Modules) on Fri Jan 22 06:45:44 2010
# If you edit this file and execute /usr/sbin/dahdi_genconf again,
# your manual changes will be LOST.
wcfxo

/etc/dahdi/system.conf

# Autogenerated by /usr/sbin/dahdi_genconf on Fri Jan 22 12:45:37 2010
# If you edit this file and execute /usr/sbin/dahdi_genconf again,
# your manual changes will be LOST.
# Dahdi Configuration File
#
# This file is parsed by the Dahdi Configurator, dahdi_cfg
#
# Span 1: WCFXO/0 "Wildcard X100P Board 1" (MASTER)
fxsks=1
echocanceller=mg2,1
# Global data
loadzone = us
defaultzone = us

如果你是在国内使用,请将上面的loadzone和 defaultzone修改成cn.


/etc/asterisk/dahdi_channels.conf

; Autogenerated by /usr/sbin/dahdi_genconf on Fri Jan 22 12:45:37 2010
; If you edit this file and execute /usr/sbin/dahdi_genconf again,
; your manual changes will be LOST.
; Dahdi Channels Configurations (chan_dahdi.conf)
;
; This is not intended to be a complete chan_dahdi.conf. Rather, it is intended
; to be #include-d by /etc/chan_dahdi.conf that will include the global settings
;
; Span 1: WCFXO/0 "Wildcard X100P Board 1" (MASTER)
;;; line="1 WCFXO/0/0 FXSKS (SWEC: MG2)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 1
callerid=
group=
context=default

按照注释说明,dahdi_channels.conf是dahdi_genconf自动生成的.包含dahdi设备需要的默认信息.然后是希望用户在才chan_dahdi.conf中include这个file的.
实际情况是,网上的帖子基本都是实际在chan_dahdi.conf中修改完事的.没人理睬这个file.我一开始配置的时候也是这么做的.直到写这篇博客的时候重读注释才发现了这个问题.其实只要简单的做下面这一步就OK了.


修改/etc/asterisk/chan_dahdi.conf,在末尾加上如下语句

#include dahdi-channels.conf

Step 4 安装Asterisk

wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.6.2.1.tar.gz
tar zxvf asterisk-1.6.2.1.tar.gz
cd asterisk-1.6.2.1
sudo ./configure;

这步会帮你检查Asterisk需要的Library,理论上按照Step 0的话这便会顺利通过.如果你需要额外的Function(例如curl,postgresql)的话,可以在这边获得相应的提示.

sudo make
sudo make install
sudo make samples

运行Asterisk
好了.验收成果的时候来了.

sudo asterisk -vvvvc
.....
*CLI>

Asterisk启动成功.然后查看一下硬件状况.

dahdi show status
Description Alarms IRQ bpviol CRC4 Fra Codi Options LBO
Wildcard X100P Board 1 OK 0 0 0 CAS Unk YEL 0 db (CSU)/0-133 feet (DSX-1)
*CLI>

可以看到Asterisk已经读到了我的X100P.然后查看一下dahdi channels的情况.

*CLI> dahdi show channels
Chan Extension Context Language MOH Interpret Blocked State
pseudo default default In Service
1 from-pstn default In Service
*CLI>

其中”1″就是我们新添加的Dahdi Channel.
注意,如果你板卡检测到了但是Channel没有显示,很可能是chan_dahdi.conf的配置问题.


一切都OK了.连上电话线,给自己打一个电话吧.默认配置就可以听到美丽的”Welcome to Open Source PBX Asterisk…”.
问题一
使用DAHDI Complete Source Tarball编译失败.
解决办法:说实话这个问题很诡异,因为之前都没有问题.我的解决办法就是使用DAHDI Linux Source Tarball和DAHDI Tools Source Tarball分别编译安装,就没有这个问题了.
问题二

bash$ dahdi_cfg
Notice: Configuration file is /etc/dahdi/system.conf
line 0: Unable to open master device '/dev/dahdi/ctl'
1 error(s) detected

解决办法:修改 /etc/modprobe.d/dahdi.blacklist.去掉wcfxo这行.该文件是用于禁止加载某一类型的dahdi驱动的,默认禁止所有类型.

参考链接
配置X100P卡详细步骤
X100P安装手册 (转)
ASTERISK1.4.0+REDHAT9.0+X100P安装
Trixbox下使用x100p卡做FXO通道外呼的实现DAHDI配置文件与zaptel的差别

 

无觅相关文章插件,快速提升流量