如何使用Sangoma E1卡做端口回环呼叫测试

来自最权威最新完整开源SIP,语音通信,融合通信中文技术文档资料,提供详细的Asterisk Freepbx, FreeSBC, 免费会话边界控制器,网关,语音板卡,IPPBX,SBC配置资料-asterisk,freepbx,freesbc 用户手册 界面配置,呼叫路由,IVR, 网关对接,拨号规则,SIP 分机呼叫,pjsip, IVR, 录音, CDR, 队列呼叫,振铃组,CLI 命令中文资料手册
James.zhu讨论 | 贡献2017年2月2日 (四) 14:49的版本 检查端口之间的连接线

跳转至: 导航搜索

Sangoma E1端口回换测试 本文档是用户用来测试Sangoma E1 卡之间的通信所搭建的环境,可以用来进行内部呼叫测试,无需运营商环境。

第1章:安装前准备

文档编写以及环境配置说明

1)本文档是Sangoma A1XX  PCI/PCI-E 系列中继数字语音板卡产品技术wiki,同样可以适用于其他端口的数字语音板卡。
   不同之处在于端口的数量不同,请客户留意!
2)测试的软件版本根据时间的不同可能有所变化,请客户下载稳定的软件版本。
3) 此文档安装环境仅支持Sangoma 回换测试的环境,不支持对接运营商的环境。
4)环境测试仅仅为了排查语音板卡本身的问题,测试环境是通过端口1呼叫端口2。

检查端口之间的连接线

我们的测试用例中,使用Sangoma E1板卡的端口1连接端口2,通过板卡本身的回换,做语音测试呼叫。
端口1和端口2通过交叉线连接。参考一下图例线序


环境搭建时必须注意的以下几个方面的问题:
1)端口1 为主时钟(Master),端口2 为从时钟(Normal)。
2) 端口1 相当于运营商侧(NET),端口2相当于 本地用户侧(CPE)。
3) 以上配置要体现在具体的配置文件中,涉及到文件包括:wanpipe1.conf, wanpipe2.conf, chan_dahdi.conf 文件。

第2章:下载 Asterisk/Dahdi/Libpri

执行命令 cd /usr/src,转到src 目录

wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz 
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz 
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.6.2-current.tar.gz

注意,以上版本只是安装板卡的例子,版本可能随时更新,请用户留意。

第3章:安装 Asterisk/Dahdi/Libpri

1)检查系统是否检测到sangoma 语音板卡:执行命令 lspci -vvv, 如果检测到板卡信息(会显示sangoma厂商信息),执行下一步;如果没有,重新拔出板卡,然后重新插入板卡。
2)检查安装必要的软件支持包-Centos 环境下,用户必须确认以下安装包成功安装!
访问链接了解安装包支持环境:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+Packages
http://www.voip-info.org/wiki/view/Asterisk+11+Installation+on+CentOS+6
http://wiki.sangoma.com/wanpipe-linux-asterisk-dahdi
Centos 环境下,安装支持包,和内核开发包:

 
yum -y install kernel-devel-$(uname -r) libtool* make gcc patch perl bison gcc-c++ ncurses-devel flex 
libtermcap-devel autoconf* automake* autoconf

Ubutun/Debian 环境下:

apt-get -y install gcc g++ automake autoconf libtool make libncurses5-dev flex bison patch libtool autoconf linux-headers-$(uname -r) sqlite3 libsqlite3-dev 

以上支持包必须确认完全正确安装,如果出现错误,请重新安装,确保所有支持包完整安装。特别留意内核开发包的安装!
3)为了安装方便,强烈建议减压 下载源代码asterisk,dahdi,libpri到 /usr/src目录下
安装dahdi 硬件接口模块

tar xvzf dahdi-linux-complete<version>
cd dahdi-linux-complete <version> 
make 
make install

安装libpri 协议支持包

tar xvfz libpri-<version>
cd libpri-<version>
make 
make install

安装asterisk

tar xvfz asterisk-<version>.tgz
cd asterisk-<version>
./configure
make
make install
make samples // 如果第一次安装,请执行这个命令;如果是更新系统,请执行前备份 /etc/asterisk 命令下的配置文件

第4章:安装Sangoma 驱动

1)下载Wanpipe驱动:下载地址:sangoma 驱动下载
2)保存文件到 /usr/src 命令下
3)减压 wanpipe

tar xvfz wanpipe-<version>.tgz
cd wanpipe-<version>
make     // 确认成功安装,无任何报错信息
make install   // 确认成功安装,无任何报错信息
 ./Setup install  // 执行脚本安装编译,确认没有任何报错信息。

如果安装Sangoma A116E

./Setup install --dahdi-chunk=40  

执行 setup 安装过程时的选项:

[root@localhost wanpipe-7.0.5]# ./Setup install
----------------------------------------------------------
          WANPIPE v7.0.5 Installation Script
    Copyright (c) 1995-2013, Sangoma Technologies Inc.
----------------------------------------------------------

WANPIPE INSTALLATION

You are about to install WANPIPE Multi-Protocol
TDM Voice & WAN Router into your system.

This script will examine your system, then install, create
and/or modify necessary files and directories.

You must have Linux Kernel Headers along with
full development tools (i.e. GNU C compiler and utilities)
installed in order to be able to install this product.

This script will automatically compile all WANPIPE kernel
drivers and install them in their appropriate directory.

If you are installing Wanpipe for ASTERISK/ZAPTEL this
script will will prompt you for zaptel source location.

If you have previoulsy installed WANPIPE, this release
will overrite/upgrade full release without the need to
uninstall first!

IMPORTANT:
It is always recommended to say YES to all options
prompted during the install!

Please visit: http://wiki.sangoma.com for more info.

Would you like to install WANPIPE now? [y] (y/n) y    // 选择y
----------------------------------------------------------
          WANPIPE v7.0.5 Installation Script
    Copyright (c) 1995-2013, Sangoma Technologies Inc.
----------------------------------------------------------

Fixing file permissions...

Verifying files and fixing permissions ...Done

Warning: Wanpipe Modules are currently running!
Its recommended to unload Wanpipe Modules before proceeding
with installation.


Would you like to proceed? (y/n) y
Checking for C developement tools ...(gcc) OK
Checking for C++ developement tools ...OK
Checking for Make utility ...OK
Checking for ncurses library ... OK
Checking for Perl developement tools ...OK
Checking for AWK ...OK
Checking for FLEX ...OK
Checking for Patch ...OK
Checking for libtermcap-devel...OK
Checking for bison...OK
Checking for libtool...OK

Press [Enter] to continue...   // 确认以上支持包成功安装。输入 Enter 键
----------------------------------------------------------
          WANPIPE v7.0.5 Installation Script
    Copyright (c) 1995-2013, Sangoma Technologies Inc.
----------------------------------------------------------


Installing WANPIPE Device Drivers: Linux KERNEL

To integrate WANPIPE Multi-Protocol Voice & WAN Router 
modules into the Linux kernel, the kernel has to be 
updated with latest wanpipe sources.  Install will only
modify existing wanpipe source that is already in the
Kernel. 

IMPORTANT:
It is always recommended to say YES to all options 
prompted during the install!

----------------------------------------------------------
          WANPIPE v7.0.5 Installation Script
    Copyright (c) 1995-2013, Sangoma Technologies Inc.
----------------------------------------------------------


Please specify absolute path name of your linux headers/source directory

Press Enter for Default: /lib/modules/2.6.32-358.23.2.el6.x86_64/build

#>
Setting linux directory to /lib/modules/2.6.32-358.23.2.el6.x86_64/build



Upgrading WANPIPE kernel documentation ...Done.


Installing WANPIPE include headers ...Done.

WANPIPE device drivers upgraded successfully!

Press [Enter] to continue...   // 输入Enter 键
----------------------------------------------------------
          WANPIPE v7.0.5 Installation Script
    Copyright (c) 1995-2013, Sangoma Technologies Inc.
----------------------------------------------------------

WANPIPE KERNEL DRIVER COMPILATION

The next step in WANPIPE installation involves compiling 
WANPIPE kernel modules.  

This script will compile and install WANPIPE modules
into the currently running linux kernel.

For greater customization you will be prompted to
select which Protocol/Drivers you would like to
build into the WANPIPE kernel modules.

Wanpipe for Asterisk/Dahdi/Zaptel
Default for Asterisk/Dahdi/Zaptel
Wanpipe for Wan Routing/API 
Default for Wan/IP Routing and Data API
Wanpipe for Asterisk SMG/SS7
Default for Asterisk SS7
Wanpipe for TDM API
Default for FreeSwitch and Voice API 

Custom Compilation:
------------------
  Customise WANPIPE driver compilation to add only the
  protocols that you need.  This way one can reduce
  the size of the WANPIPE kernel drivers.

Refer to http://wiki.sangoma.com for more info

grep: /lib/modules/2.6.32-358.23.2.el6.x86_64/build/include/include/autoconf.h: No such file or directory
grep: /lib/modules/2.6.32-358.23.2.el6.x86_64/build/include/include/autoconf.h: No such file or directory
----------------------------------------------------------
          WANPIPE v7.0.5 Installation Script
    Copyright (c) 1995-2013, Sangoma Technologies Inc.
----------------------------------------------------------


Please Select Compilation Mode

1. WAN Protocols Support 
       Protocols: Frame Relay, CHDLC, PPP, ATM, X25, ADSL, TDM API
       Default for: Wan Routing, Data & Voice API devel.

2. Asterisk/Dahdi Support 
       Asterisk protocols: libpri (PRI,BRI), Analog (FXO/FXS), libss7 (SS7)
       Default for: Asterisk 

3. Asterisk/Dahdi + WAN Protocol Support

4. TDM API (libsangoma)  
       Protocols: TDM API (libsangoma) on AFT adapters:
       Default for: FreeSWITCH, Yate, Sunrise
                    Custom voice development 

5. Custom Compilation Mode
       Specify protocols to be added into the WANPIPE
       kernel drivers.

6. Deprecated: SMG (BRI) (Asterisk SMG/BRI [Use Asterisk/Dahdi option 2 instead])

7. Deprecated: SMG (BRI) + Asterisk/Dahdi [Use Asterisk/Dahdi option 2 instead]


Please select (1-7) [Default: 1]: 2  // 现在 2 在asterisk 环境下安装E1 卡

Looking for zaptel/dahdi directory in /usr/src ...
-------------------------------------------
1 : /usr/src/dahdi-linux-complete-2.7.0.1+2.7.0.1 
------------------------------------------ 
------------------------------------------ 
m : Enter zaptel path manually

(ctrl-c to Exit)
Please select working zaptel directory [1-1][m]: 1  // 输入 1 选择 dahdi 源代码安装路径,如果dahdi 没有安装在默认的路径下,需要手动添加路径

Enabling the TDM Voice Asterisk Support
                                                      
Dahdi HW HDLC Support Detected: Enabling DCHAN Feature
Native Dahdi HW HDLC Support Detected - No patch required
Dahdi source unmodified
                        
Checking for UDEV Zaptel compatibility...     Dahdi installed, no need to add UDEV rules
Enabling the AFT TE1 Support

Checking for SMP support ...Enabled.

Checking current processor type ...x86_64

Wan Update Flags:  -DAF_WANPIPE_2612_FORCE_UPDATE -DWANPIPE_MOD_266_FORCE_UPDATE
Checking fo regparm: Disabled


--------------------------------------------------
CFLAGS: gcc -Wp,-MD,.wanpipe.o.d -nostdinc -iwithprefix include -D__LINUX__ -Dlinux -D__KERNEL__ -I/usr/include/wanpipe -I/lib/modules/2.6.32-358.23.2.el6.x86_64/build/include  -DMODULE   -DAF_WANPIPE_2612_FORCE_UPDATE -DWANPIPE_MOD_266_FORCE_UPDATE     
--------------------------------------------------

Compiling General WANPIPE Driver for 2.6.X Kernel .....Done.


WAN HWEC module enabled and compiled!
Linking Wanpipe Driver and protocols ...Done.

Updating Kernel Modules ...Done.

Visually Confirm that driver compilation was successful! (y/n) y  // 选择 y
Compilation Successful.
----------------------------------------------------------
          WANPIPE v7.0.5 Installation Script
    Copyright (c) 1995-2013, Sangoma Technologies Inc.
----------------------------------------------------------

WANPIPE META CONFIGURATION

There are two configuration files associated with WANPIPE.  

1) /usr/src/wanpipe-7.0.5/wanrouter.rc: 
- defines locations of important files such as lock
  and configuration files as well as start/stop 
  order of multiple WANPIPE devices.
2) /usr/src/wanpipe-7.0.5/wanpipe1.conf:
- main configuration file for each WANPIPE device.
- defines interfaces, hardware and protocol information.
- this file can be created using the 'wancfg' GUI
  utility or manually based on sample files located
  in /etc/wanpipe/samples.
  
Please read the WanpipeInstallation.(pdf/txt) manual for further
information.

Press [Enter] to continue...  // 输入 Enter

Wanpipe META config file found in /etc/wanpipe directory

Wanpipe startup sequence: wanpipe1

Would you like to keep the original wanpipe startup sequence? (y/n) y //  选择 y

Please specify a desired location for WANPIPE configuration files.

(Press Enter for Default: /etc/wanpipe)

<specify path:>

Please specify a desired location for WANPIPE interface files.

(Press Enter for Default: /etc/wanpipe/interfaces)

<specify path:>  // 摁Enter 键, 板卡配置文件路径


Please specify a location for WANPIPE binary, firmware files.

(Press Enter for Default: /etc/wanpipe/firmware)

<specify path:>  //摁 Enter 键。
----------------------------------------------------------
          WANPIPE v7.0.5 Installation Script
    Copyright (c) 1995-2013, Sangoma Technologies Inc.
----------------------------------------------------------

WANPIPE UTILITIES SETUP

WANPIPE utilities are used to:
1) create configuration files: for Zaptel and Asterisk
/usr/sbin/wancfg_dahdi#Dahdi and Asterisk
/usr/sbin/wancfg_zaptel#Zaptel and Asterisk
/usr/sbin/wancfg_smg#BRI/SS7, Dahdi/Zaptel and Asterisk
/usr/sbin/wancfg_tdmapi#TDM API
2) create WANPIPE WAN/IP configuration files.
(/usr/sbin/wancfg)
3) start,stop,restart individual/all devices and interfaces.
(/usr/sbin/wanrouter)
4) debug line, protocol and driver problems.
(/usr/sbin/wanpipemon)
5) aid in WANPIPE API development
(/etc/wanpipe/api)

Refer to the WanpipeInstallation.(pdf/txt) for more information.

Press [Enter] to continue... // 摁 Enter
Compiling WANPIPE LibSangoma API library ...Done.


Compiling WANPIPE LibStelephony API library ...Done.



Compiling WANPIPE Utilities ...Done.


Compiling WANPIPE WanCfg Utility ...Done.


Compiling WANPIPE LibStelephony API Library ... skipped, not required.


Compiling WANPIPE API Development Utilities ... skipped, not required.


Compiling WANPIPE HWEC Utilities ...Done.


WANPIPE Environment Setup Complete !!!

Press [Enter] to continue...  // 摁 Enter 键
Installing WANPIPE Files ... !
Installing  WANPIPE Utilities in /usr/sbin
Installing wanrouter.rc in /etc/wanpipe
Installing wanpipe libraries in /etc/wanpipe
Installing firmware in /etc/wanpipe/firmware
Installing documentation in /usr/share/doc/wanpipe
cp: omitting directory `doc/man'
Installing sample api code in /etc/wanpipe/api
Installing AFT Firmware update utility in /etc/wanpipe/util
Installing driver headers in /etc/wanpipe/api/include/linux
Installing Hardware Echo Cancel Utilites
Press [Enter] to continue...  // 摁 Enter 键
----------------------------------------------------------
          WANPIPE v7.0.5 Installation Script
    Copyright (c) 1995-2013, Sangoma Technologies Inc.
----------------------------------------------------------


WANPIPE BOOTSTRAP CONFIGURATION

Your system uses System V -style initialization scripts.  You have an option
to add router start-up script to those scripts so that the router will start
automatically when system enters multi-user mode and shut down when it enters
single-user mode or when it is halted.

i.e. By selecting this option WANPIPE will startup on system bootup and 
     stop on system shutdown.

Would you like to install WANPIPE start-up scripts? (y/n) y  // 输入 y

########################################################################
#               Sangoma Wanpipe                                  #
#        Dahdi/Zaptel/SMG/TDMAPI/BOOT Configuration Script             #
#                             v2.39                                    #
#                     Sangoma Technologies Inc.                        #
#                        Copyright(c) 2013.                            #
########################################################################

Current boot level is 3

Wanrouter boot scripts configuration...

Removing existing wanrouter boot scripts...OK
Verifying Zaptel boot scripts...
Enabling wanrouter boot scripts ...(level:8)
Enabling wanrouter shutdown scripts ...(level:91)
----------------------------------------------------------
          WANPIPE v7.0.5 Installation Script
    Copyright (c) 1995-2013, Sangoma Technologies Inc.
----------------------------------------------------------

WANPIPE INSTALLATON: COMPLETE

WANPIPE installation is now complete. WANPIPE kernel drivers 
and configuration/debug utilities have been compiled and installed.

1) Proceed to configure the WANPIPE drivers:
Asterisk/Dahdi   : /usr/sbin/wancfg_dahdi
Asterisk/Zaptel  : /usr/sbin/wancfg_zaptel
TDM API          : /usr/sbin/wancfg_tdmapi
SMG SS7/BRI/PRI  : /usr/sbin/wancfg_smg
WAN Routing/API  : /usr/sbin/wancfg
2) Use the /usr/sbin/wanrouter startup script to start and stop
   the router. (eg: wanrouter start)
3) To uninstall WANPIPE package run ./Setup remove

Please read http://wiki.sangoma.com for further instructions.


Wanpipe / Zaptel Configuration
==============================

wancfg_zaptel configurator can create all wanpipe config files
for ZAPTEL including /etc/zaptel.conf file.
Optionally: the configurator can also create Asterisk zapata.conf
-----------------------------------------------------
Would you like to configure wanpipe devices for DAHDI? (y/n) y  // 输入 y

########################################################################
#               Sangoma Wanpipe                                  #
#        Dahdi/Zaptel/SMG/TDMAPI/BOOT Configuration Script             #
#                             v2.39                                    #
#                     Sangoma Technologies Inc.                        #
#                        Copyright(c) 2013.                            #
########################################################################

Would you like to generate /etc/asterisk/chan_dahdi.conf
 1. YES
 2. NO
[1-2]:1  // 输入1 , 创建默认chan_dahdi.conf 文件

-------------------------------------------------------
Configuring T1/E1 cards [A101/A102/A104/A108/A116/T116]
-------------------------------------------------------
A101 detected on slot:4 bus:4

-----------------------------------------------------------
Configuring port 1 on A101 slot:4 bus:4.
-----------------------------------------------------------

Select media type for AFT-A101 on port 1 [slot:4 bus:4 span:1]
 1. T1
 2. E1
 3. Unused
 4. Exit
[1-4]:2  // 选择 2, 配置为E1 类型

Configuring port 1 on AFT-A101 as E1, line coding:HDB3, framing:CRC4 
 1. YES - Keep these settings
 2. NO  - Configure line coding and framing
[1-2, ENTER='YES']:2  // 是否安装HDB3, CRC4 方式创建文件;如果不带CRC4, 选择2, 修改配置文件

Select line coding for port 1 on 101
 1. HDB3
 2. AMI
[1-2, ENTER='HDB3']:1 // 选择 1

Select framing for port 1 on 101
 1. CRC4
 2. NCRC4
 3. UNFRAMED
[1-3, ENTER='CRC4']:2  // 选择不支持CRC4

Select clock for AFT-101 on port 1 [slot:4 bus:4 span:1]
 1. NORMAL
 2. MASTER
[1-2]:1  // 选择 2, 作为Master,或者将来修改配置文件。

Select signalling type for AFT-101 on port 1 [slot:4 bus:4 span:1]
 1. Zaptel/Dahdi - PRI CPE
 2. Zaptel/Dahdi - PRI NET
 3. Zaptel/Dahdi - E & M
 4. Zaptel/Dahdi - E & M Wink
 5. Zaptel/Dahdi - FXS - Loop Start
 6. Zaptel/Dahdi - FXS - Ground Start
 7. Zaptel/Dahdi - FXS - Kewl Start
 8. Zaptel/Dahdi - FX0 - Loop Start
 9. Zaptel/Dahdi - FX0 - Ground Start
 10. Zaptel/Dahdi - FX0 - Kewl Start
 11. Sangoma SMG/sangoma_prid- PRI CPE
 12. Sangoma SMG/sangoma_prid- PRI NET
[1-12]:2  // 选择NET 网络侧。

Select switchtype for AFT-101 on port 1 
 1. National ISDN 2
 2. Nortel DMS100
 3. AT&T 4ESS
 4. Lucent 5ESS
 5. EuroISDN
 6. Old National ISDN 1
 7. Q.SIG
[1-7]:5 // 选择5


Would you like to enable hardware DTMF detection?
 1. YES
 2. NO
[1-2, ENTER='YES']:1  // 选择 1

Would you like to enable hardware fax detection?
 1. YES
 2. NO
[1-2, ENTER='NO']:1 // 选择 1

Configuring port 1 on AFT-101 as a full E1
 1. YES - Use all channels
 2. NO  - Configure for fractional
[1-2, ENTER='YES']:1 // 使用所有通道

Select dialplan context for AFT-101 on port 1
 1. from-pstn
 2. from-internal
 3. Custom
[1-3]:1  // 选择1


Port 1 on AFT-A101 configuration complete...
Press any key to continue:  // 摁Enter 继续检测安装

T1/E1 card configuration complete.
Press any key to continue:  // 摁 Enter 键,进行其他板卡检测
-------------------------------------------
Configuring ISDN BRI cards [A500/B500/B700]
-------------------------------------------

No Sangoma ISDN BRI cards detected

Press any key to continue: // 摁 enter
------------------------------------
Configuring GSM cards [W400]
------------------------------------

No Sangoma GSM cards detected

Press any key to continue: // 摁Enter
------------------------------------
Configuring analog cards [A200/A400/B600/B610/B700/B800]
------------------------------------
------------------------------------
Configuring USB devices [U100]
------------------------------------

###################################################################
#                             SUMMARY                             #
###################################################################

  1 T1/E1 port(s) detected, 1 configured
  0 ISDN BRI port(s) detected, 0 configured
  0 analog card(s) detected, 0 configured
  0 GSM card(s) detected, 0 configured
  0 usb device(s) detected, 0 configured

Configurator will create the following files:
1. Wanpipe config files in /etc/wanpipe
2. Dahdi config file /etc/dahdi/system.conf
3. chan_dahdi config file /etc/asterisk/chan_dahdi.conf


Your original configuration files will be saved to:
1. /etc/dahdi/system.conf.bak 
2. /etc/asterisk/chan_dahdi.conf.bak 


Your configuration has been saved in /etc/wanpipe/debug-2013-11-21.tgz.
When requesting support, email this file to techdesk@sangoma.com


###################################################################

Configuration Complete! Please select following:
 1. YES - Continue
 2. NO - Exit
[1-2]:1  // 选择 1, 继续配置


Dahdi and Wanpipe configuration complete: choose action
 1. Save cfg: Restart Asterisk & Wanpipe now
 2. Save cfg: Restart Asterisk & Wanpipe when convenient
 3. Save cfg: Stop Asterisk & Wanpipe now
 4. Save cfg: Stop Asterisk & Wanpipe when convenient
 5. Save cfg: Save cfg only (Not Recommended!!!)
 6. Do not save cfg: Exit
[1-6]:2  // 选择 2 或者 3。


Stopping Asterisk...
Waiting for inactivity to perform halt

Stopping Wanpipe...


Shutting down wanpipe1 interface: w1g1
Shutting down device: wanpipe1
No devices running, Unloading Modules


Unloading Dahdi modules...
FATAL: Module dahdi is in use.
Error executing command:
modprobe -r dahdi   // 忽略这些错误

Would you like to continue?
 1. No - exit
 2. YES  
[1-2, ENTER='No']:1 2  // 选择2


Removing old configuration files...

Copying new Wanpipe configuration files...

Copying new Dahdi configuration file (/etc/dahdi/system.conf)...

Copying new chan_dahdi configuration files (/etc/asterisk/chan_dahdi.conf)...

Starting Wanpipe...

Starting WAN Router...
Loading WAN drivers: wanpipe done.
Starting up device: wanpipe1
--> Loading ec image OCT6116-64S.ima...
Configuring interfaces: w1g1 
done.

Loading Dahdi...
DAHDI Tools Version - 2.7.0.1

DAHDI Version: 2.7.0.1
Echo Canceller(s): HWEC
Configuration
======================

SPAN 1: CCS/HDB3 Build-out: 0 db (CSU)/0-133 feet (DSX-1)

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

Starting Asterisk...
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)

Listing Asterisk channels...

   Chan Extension  Context         Language   MOH Interpret        Blocked    State      Description                     
 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                                 

Type "asterisk -r" to connect to Asterisk console


Wanrouter start complete...
Current boot level is 3

Wanrouter boot scripts configuration...

Removing existing wanrouter boot scripts...OK
Would you like wanrouter to start on system boot?
 1. YES
 2. NO
[1-2]:1 // 选择 1

Verifying Dahdi boot scripts...
Verifying Dahdi boot scripts...Enabled (level:13)
Verifying Dahdi shutdown scripts...Enabled (level:87)
Enabling wanrouter boot scripts ...(level:12)
Enabling wanrouter shutdown scripts ...(level:86)

Would you like to execute 'dahdi_cfg' each time wanrouter starts?
 1. YES
 2. NO
[1-2]:1  // 选择 1

Removing old smg_ctrl boot.....OK
Removing old smg_ctrl_safe boot.....OK
Sangoma cards configuration complete, exiting...

You have new mail in /var/spool/mail/root
[root@localhost wanpipe-7.0.5]#   到此,板卡配置完成。如果是2,4,8,或者16E1板卡,脚本在安装过程中会自动检测
第2口,第3口,依此类推。重复执行相应的次数。

以下信息是驱动安装时的提示一些特别说明信息,请选择正确的选项。如果选择错误,可以重新执行Setup-sangoma 来重新配置.
以下信息是安装过程中对中国用户的选项,如果成功安装,可以跳过 步骤 4.

4)'''执行脚本安装过程中,中国用户需要选择的选项''',请小心操作:
Select media type->E1  // 支持中国E1
Select linecode-> HDB3  // E1接口支持两种线路编解码格式:AMI格式和HDB3格式。默认HDB3
Select framing-> NCRC4  // 是否需要支持CRC4 校验,如果不支持选择此项。大多数中国客户使用NCRC4
Select Clock-> Normal
Select Signalling type-> PRI CPE  // 运营商端上NET 网络侧,本地必须选择CPE 用户侧
Select switchtype -> EuroISDN
Select Configure port for full use->yes
Select Dialplan context-> PSTN   // 注意,到这一步,一个端口就算配置完成了,脚本会重复配置 第2 口,3口。。直到配置完所有的板卡端口。
Configuration complete-> Yes
Dahdi and Wanpepe configuration complete-> 选择 2
would you like to continue->Yes
would you like  wanrouter to start on system boot-> yes
would you like to execute dahdi_cfg each time wanrouter starts-> 选择 1

第5章:配置驱动通道

脚本配置完成以后,执行这个命令:

wanrouter hwprobe

如果可以正确显示板卡信息,和端口信息,说明板卡可以正常工作。如果出现报错信息,请联系sangoma中国
邮箱:james.zhu@hiastar.com

检查端口1 Master 配置文件

脚本会自动生成wanpipe 配置文件,在 /etc/wanpipe 目录下,自动生成每个端口文件 /etc/wanpipe/wanpipe1.conf
wanpipe2.conf wanpipeX.conf 文件。 X 代表端口数。多少端口会有多少个相应的配置文件。
例如,以下是端口1 的配置参数。因为我们需要设置端口1 为主时钟,所以需要做相应的修改。

#================================================
# WANPIPE1 Configuration File
#================================================
#
# Date: Wed Dec  6 20:29:03 UTC 2006
#
# Note: This file was generated automatically
#       by /usr/local/sbin/setup-sangoma program.
#
#       If you want to edit this file, it is
#       recommended that you use wancfg program
#       to do so.
#================================================
# Sangoma Technologies Inc.
#================================================

[devices]
wanpipe1 = WAN_AFT_TE1, Comment

[interfaces]
w1g1 = wanpipe1, , TDM_VOICE, Comment

[wanpipe1]
CARD_TYPE 	= AFT
S514CPU 	= A
CommPort 	= PRI
AUTO_PCISLOT 	= NO
PCISLOT 	= 4    // 绑定了PCI 4 插槽,如果换PCI插槽,需要重新执行脚本配置板卡
PCIBUS  	= 22
FE_MEDIA	= E1  
FE_LCODE	= HDB3  // 线路编码
FE_FRAME	= NCRC4
FE_LINE		= 1
'''TE_CLOCK 	= Master // 端口1 是主时钟,作为运营商。'''
TE_REF_CLOCK    = 0
TE_SIG_MODE     = CAS
TE_HIGHIMPEDANCE	= NO
TE_RX_SLEVEL    = 430
LBO 		= 120OH
FE_TXTRISTATE	= NO
MTU 		= 1500
UDPPORT 	= 9000
TTL		= 255
IGNORE_FRONT_END = NO
TDMV_SPAN	= 1
TDMV_DCHAN	= 16  // D 通道信令控制
TDMV_HW_DTMF	= YES
TDMV_HW_FAX_DETECT = YES

[w1g1]
ACTIVE_CH	= ALL
TDMV_HWEC	= YES   // 带硬件回声模块的E1板卡
MTU 		= 8

端口2 是正常的Normal 状态,无需修改。 注意,如果修改了任何 wanpipeX.conf 或者system.conf 文件,都需要重新启动wanpipe 驱动(建议重新启动服务器环境)。 自动生成 /etc/dahdi/system.conf 自动生成 /etc/asterisk/chan_dahdi.conf

检查硬件回声模块

执行命令 wanrouter hwprobe

A200d : 32
A101d : 32
A102d : 64
A104d : 128
A108d : 256
A500d : 64        

如果贵公司购买的板卡是带回声抑制模块的板卡,例如 A101D,应该显示 32;如果结果显示是0,请联系sangoma 中国:james. zhu@hiastar.com

检查dahdi 配置文件 /etc/asterisk/chan_dahdi.conf

注意,此配置文件是4E1板卡配置文件,根据购买的板卡端口数量,配置文件的通道数有所不同!

#autogenerated by /usr/sbin/wancfg_dahdi do not hand edit
#autogenrated on 2011-10-09
#Dahdi Channels Configurations 
#For detailed Dahdi options, view /etc/dahdi/system.conf.bak
loadzone=cn
defaultzone=cn

#Sangoma A104 port 1 [slot:4 bus:22 span:1] <wanpipe1>
span=1,1,0,ccs,hdb3
bchan=1-15,17-31
hardhdlc=16   
# echocanceller=mg2,1-15,17-31  // 如果带硬件回声模块,需要注释掉这一行配置。如果软件回声模块,打开注释。
#Sangoma A104 port 2 [slot:4 bus:22 span:2] <wanpipe2>
span=2,2,0,ccs,hdb3
bchan=32-46,48-62
# echocanceller=mg2,32-46,48-62
hardhdlc=47

#Sangoma A104 port 3 [slot:4 bus:22 span:3] <wanpipe3>
span=3,3,0,ccs,hdb3
bchan=63-77,79-93
# echocanceller=mg2,63-77,79-93
hardhdlc=78

#Sangoma A104 port 4 [slot:4 bus:22 span:4] <wanpipe4>
span=4,4,0,ccs,hdb3
bchan=94-108,110-124
# echocanceller=mg2,94-108,110-124
hardhdlc=109

检查asterisk 应用层chan_dahdi.conf 通道配置文件

;autogenerated by /usr/sbin/wancfg_dahdi do not hand edit
;autogenrated on 2011-10-09
;Dahdi Channels Configurations 
;For detailed Dahdi options, view /etc/asterisk/chan_dahdi.conf.bak

[trunkgroups]   // 默认的sangoma 脚本可能丢失此标签,需要手动添加

[channels]  // 默认的sangoma 脚本配置可能丢失此标签,需要手动添加,否则asterisk CLI命令: dahdi show channels 无任何显示结果
context=default
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
canpark=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=yes
relaxdtmf=yes
rxgain=0.0
txgain=0.0
group=1
callgroup=1
pickupgroup=1
immediate=no
pridialplan=local  // 支持PRI 拨号规则本地用户
prilocaldialplan=local
;Uncomment these lines if you have problems with the disconection of your analog lines

#include dahdi-channels.conf
#include chan_dahdi_additional.conf

以下是dahdi-channels.conf 文件,包含4个端口的124个通道
修改端口1 的signalling = pri_net。


; Span 1: WPE1/0 "wanpipe1 card 0" (MASTER) 
group=0
context=from-pstn
switchtype = euroisdn
signalling = pri_net  // 端口1 对应的是Master 主时钟
channel => 1-15,17-31   // 如果是A101 线路,显示31 路
context = default
;group = 63

; Span 2: WPE1/1 "wanpipe2 card 1" 
group=1
context=from-pstn
switchtype = euroisdn
signalling = pri_cpe
channel => 32-46,48-62
context = default
;group = 63

; Span 3: WPE1/2 "wanpipe3 card 2" 
group=2
context=from-pstn
switchtype = euroisdn
signalling = pri_cpe
channel => 63-77,79-93
context = default
;group = 63

; Span 4: WPE1/3 "wanpipe4 card 3" 
group=3
context=from-pstn
switchtype = euroisdn
signalling = pri_cpe
channel => 94-108,110-124
context = default
;group = 63

检查通道的状态

Sangoma 语音板卡的安装步骤已经完成,如果以上这些步骤没有任何错误的话,客户在呼叫之前需要
确认以下几个技术参数,然后再进行通话测试。

检查端口1和端口2的物理连接状态 
[root@localhost ~]# wanrouter status

Devices currently active:
        wanpipe1 wanpipe2 wanpipe3 wanpipe4


Wanpipe Config:

Device name | Protocol Map | Adapter  | IRQ | Slot/IO | If's | CLK | Baud rate |
wanpipe4    | N/A          | A101/1D/2/2D/4/4D/8/8D/16/16D| 19  | 1       | 1    | N/A | 0         |
wanpipe3    | N/A          | A101/1D/2/2D/4/4D/8/8D/16/16D| 19  | 1       | 1    | N/A | 0         |
wanpipe2    | N/A          | A101/1D/2/2D/4/4D/8/8D/16/16D| 19  | 1       | 1    | N/A | 0         |
wanpipe1    | N/A          | A101/1D/2/2D/4/4D/8/8D/16/16D| 19  | 1       | 1    | N/A | 0         |

Wanrouter Status:

Device name | Protocol | Station | Status        |
wanpipe4    | AFT TE1  | N/A     | Disconnected  |
wanpipe3    | AFT TE1  | N/A     | Disconnected  |
wanpipe2    | AFT TE1  | N/A     | Connected     |
wanpipe1    | AFT TE1  | N/A     | Connected     |

说明端口1连接了端口2。

[root@localhost ~]# wanpipemon -i w1g1 -c Ta

***** w1g1: E1 Rx Alarms (Framer) *****

ALOS:   OFF     | LOS:  OFF
RED:    OFF     | AIS:  OFF
LOF:    OFF     | RAI:  OFF

***** w1g1: E1 Rx Alarms (LIU) *****

Short Circuit:  OFF
Open Circuit:   OFF
Loss of Signal: OFF

***** w1g1: E1 Tx Alarms *****

AIS:    OFF     | YEL:  OFF


***** w1g1: E1 Performance Monitoring Counters *****

Line Code Violation     : 0
Far End Block Errors    : 0
CRC4 Errors             : 0
FAS Errors              : 0
Sync Errors             : 0


Rx Level        : > -2.5db



物理连接正常,所有连接状态都是OFF,无报错。

1) 登录系统后台,执行命令 dmesg, 检查打印信息,确认没有任何和板卡dahdi相关的报错信息。
2) 启动asterisk,执行asterisk -r, 进入asterisk CLI 后台,确认:
3) 执行命令:dahdi show channels, 如果显示有通道数量,说明通道配置正确。
4) 执行 pri show spans, 如果显示了spans 的数量,而且是 up,active 说明系统正常,可以呼入测试。
5)执行 pri show spans,如果状态显示是down  inactive/active, 检查配置或者硬件板卡。

在5)执行以后,如果出现down,inactive, 状态退出asterisk CLI 命令。
确认wanrouter start 已经执行,并且成功启动,执行Sangoma工具检测命令:

*CLI>
*CLI> pri show spans
PRI span 1/0: Up, Active
PRI span 2/0: Up, Active
PRI span 3/0: In Alarm, Down, Active
PRI span 4/0: In Alarm, Down, Active
*CLI>

端口1 和端口2 都是up active 状态,可以进行呼叫。

第6章:测试呼叫

这里,我们介绍的只是一个非常简单的呼入呼出例子。注册一个分机SIP分机100,通过SIP分机100 呼叫
呼叫流程:分机100 呼叫 端口1 的通道12呼出,然后呼入到端口2,端口2呼入的电话进行语音播放。

需要修改的配置文件

1)SIP 100 创建的用户的context=from-test。
2) chan_dahdi.conf 文件中的端口2 的context是port2

呼叫测试的拨号规则


[from-test]  // 对应SIP 100 的SIP.conf 文件
exten => 100,1,dial(dahdi/12/10000)  // 通过端口1 的通道12 呼出
exten => 100,2,hangup

[port2]  // 对应 chan_dahdi.conf 文件中的端口2 的context。
exten => 10000,1,Wait(0.25)
exten => 10000,2,Answer()
exten => 10000,n,Playback(tt-weasels)

呼入到端口2, 然后播放语音,SIP 分机100可以听到系统播放的语音。

呼出测试

*CLI>     -- Registered SIP '100' at 192.168.1.102:20452
       > Saved useragent "X-Lite release 1011s stamp 41150" for peer 100
[Feb  5 17:31:17] NOTICE[2651]: chan_sip.c:27884 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 100
[Feb  5 17:32:17] NOTICE[2651]: chan_sip.c:27884 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 100
[Feb  5 17:34:17] NOTICE[2651]: chan_sip.c:27884 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 100
  == Using SIP RTP CoS mark 5
    -- Executing [100@from-test:1] Dial("SIP/100-00000000", "dahdi/12/10000") in new stack
    -- Requested transfer capability: 0x00 - SPEECH
    -- Called dahdi/12/10000
    -- Accepting call from '100' to '10000' on channel 0/12, span 2
    -- Executing [10000@port2:1] Wait("DAHDI/i2/100-1", "0.25") in new stack
    -- DAHDI/i1/10000-1 is proceeding passing it to SIP/100-00000000
    -- Executing [10000@port2:2] Answer("DAHDI/i2/100-1", "") in new stack
    -- DAHDI/i1/10000-1 answered SIP/100-00000000
    -- Executing [10000@port2:3] Playback("DAHDI/i2/100-1", "tt-weasels") in new stack
    -- <DAHDI/i2/100-1> Playing 'tt-weasels.gsm' (language 'en')
       > 0x7f5500015520 -- Probation passed - setting RTP source address to 192.168.1.102:20666
    -- Auto fallthrough, channel 'DAHDI/i2/100-1' status is 'UNKNOWN'
    -- Hungup 'DAHDI/i2/100-1'
    -- Span 1: Channel 0/12 got hangup request, cause 16
    -- Hungup 'DAHDI/i1/10000-1'
  == Spawn extension (from-test, 100, 1) exited non-zero on 'SIP/100-00000000'

如果呼入呼出正常,说明语音板卡可以正常工作。

第7章:E1语音板卡知识库

1)Sangoma A1XX 线路数字语音板卡支持E1 支持30B+D PRI(PRA),速率是2.048Mbit/s ,
默认使用成复帧的E1中,除了第0时隙外,第16时隙(D 通道)是用于传输信令的,只有第1(B 通道)到15,
第17到第31共30个时隙可用于传输有效数据或者语音
2)安装sangoma 语音板卡时需要注意阻抗/帧结构/CRC4校验,如果以上数据出现双方不匹配,可能导致
不通/误码/滑码/失步等问题,请联系运营商确认以上参数必须和本地完全匹配。
3) Sangoma 板卡的主要应用环境:呼叫中心,电子传真,企业IVR服务,落地,语音转换。
4) Sangoma 板卡是否支持满配?是的,1:1 满配。保证30路满负荷,语音清晰。
5) 查看E1语音板卡的物理连接是否良好,E1线路状态诊断工具
6) E1 PRI线路听不到彩铃或者语音提示,修改拨号规则(extensions.conf),在dial 命令前添加 progress(),例如:

exten => _X.,1, Progress()
exten => _X.,n, Dial(dahdi/g0/1866512XXXX)