如何在FreeSWITCH开源软交换安装Sangoma-A400模拟卡

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在FreeSWITCH开源软交换安装Sangoma-A400模拟卡相关的知识,希望对你有一定的参考价值。

参考技术A   FreeSWITCH 是目前非常流行的开源软交换平台,支持IPPBX,软交换调度,IVR系统,呼叫中心等等解决方案,同时支持PSTN的接入方式。Sangoma 模拟语音卡可以通过FreeTDM 模块和freeSWITCH 实现通信。
  准备工作
  检测板卡配件, 确认板卡的RJ11 配线,sangoma 附件配置包含了RJ11 的窄头线。
  如果支持FXS,板卡必须上电。如果A400 无FXS 也需要上电。并且检测12V 电脑电源接口
  插入模拟板卡,确认支持PCI-E 或者PCI卡
  通过系统命令 lspci 检查系统是否检测到语音板卡,执行系统命令,lspci -vvv,可以看到如下结果:
  05:04.0 Network controller: Sangoma Technologies Corp. A200/Remora FXO/FXS Analog AFT card
  Subsystem: NEC Corporation Device 1300
  Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
  Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
  Latency: 255 (1250ns min, 3750ns max)
  Interrupt: pin A routed to IRQ 185
  Region 0: Memory at f7200000 (32-bit, non-prefetchable) [size=64K]
  解压压缩包
  tar xfz wanpipe-current.tgz
  cd wanpipe-<version>.tgz

  编译板卡驱动和freetdm
  执行编译安装命令
  make freetdm
  make install

  下载安装配置FreeSWITCH
  安装linux Centos 支持包
  yum install expat-devel openssl-devel libtiff-devel libX11-devel unixODBC-devel libssl-devel python-devel \
  zlib-devel libzrtpcpp-devel alsa-lib-devel libogg-devel libvorbis-devel perl-libs gdbm-devel \
  libdb-devel uuid-devel @development-tools

  安装git 以后,使用git 安装 freeSWITCH
  安装FreeSWITCH
  git clone git://git.freeswitch.org/freeswitch.git
  cd freeswitch
  ./bootstrap.sh

  编译前,添加freetdm 模块,编辑modules.conf 文件,注释掉libs/freetdm/mod_freetdm 模块,保存文件。 执行
  ./configure
  make
  make install
  make all install cd-sounds-install cd-moh-install // 安装语音文件和语音等待文件

  配置Sangoma 板卡文件
  执行 /usr/sbin/wancfg_fs 命令,启动配置脚本,通过选项来一步步配置板卡
  [root@localhost sbin]# wancfg_fs
  ########################################################################
  # Sangoma Wanpipe #
  # Dahdi/Zaptel/SMG/TDMAPI/BOOT Configuration Script #
  # v2.39 #
  # Sangoma Technologies Inc. #
  # Copyright(c) 2013. #
  ########################################################################

  Would you like to change FreeSWITCH Configuration Directory?
  Default: /usr/local/freeswitch/conf
  1. NO
  2. YES
  [1-2, ENTER='NO']:1 // 选择默认安装目录

  -------------------------------------------------------
  Configuring T1/E1 cards [A101/A102/A104/A108/A116/T116]
  -------------------------------------------------------

  No Sangoma ISDN T1/E1 cards detected

  Press any key to continue:
  -------------------------------------------
  Configuring ISDN BRI cards [A500/B500/B700]
  -------------------------------------------

  No Sangoma ISDN BRI cards detected

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

  No Sangoma GSM cards detected

  Press any key to continue:
  ------------------------------------
  Configuring analog cards [A200/A400/B600/B610/B700/B800]
  ------------------------------------

  -----------------------------------------------------------
  A400 detected on slot:4 bus:3
  -----------------------------------------------------------

  Would you like to configure AFT-400 on slot:4 bus:3
  1. YES
  2. NO
  [1-2]:1 // 选择yes

  Which codec will be used?
  1. MULAW - North America
  2. ALAW - Europe
  [1-2]:2 // ALAW

  Which Operation Mode will be used?
  1. FCC
  2. TBR21
  3. AUSTRALIA
  [1-3, ENTER='FCC']: 1 // 无中国制式,暂时选择FCC。 如果修改到中国制式,修改/etc/wanpipe/wanpipe1.conf 文件 的 TDMV_OPERMODE = CHINA

  Press any key to continue:
  AFT-400 configured on slot:4 bus:3 span:1

  Analog card configuration complete

  Press any key to continue:
  ------------------------------------
  Configuring USB devices [U100]
  ------------------------------------

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

  0 T1/E1 port(s) detected, 0 configured
  0 ISDN BRI port(s) detected, 0 configured
  1 analog card(s) detected, 1 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. freetdm config file /usr/local/freeswitch/conf/freetdm.conf
  3. freetdm_xml config file /usr/local/freeswitch/conf/freetdm.conf.xml

  Your configuration has been saved in /etc/wanpipe/debug-2013-07-31.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 // 选择继续

  Wanpipe configuration complete: choose action
  1. Save cfg: Stop Wanpipe now
  2. Do not save cfg: Exit
  [1-2]:1 // 选择立即停止wanpipe

  sh: asterisk: command not found
  sh: asterisk: command not found

  Stopping Wanpipe...

  Removing old configuration files...

  Copying new Wanpipe configuration files...

  Copying new freetdm configuration files (/usr/local/freeswitch/conf/freetdm.conf)...

  Copying new freetdm configuration files (/usr/local/freeswitch/conf/autoload_configs/freetdm.conf.xml)...

  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 // 选择系统自动启动

  Verifying Zaptel boot scripts...
  Enabling wanrouter boot scripts ...(level:8)
  Enabling wanrouter shutdown scripts ...(level:91)
  Sangoma cards configuration complete, exiting...

  [root@localhost sbin]# reboot

  Broadcast message from root (pts/1) (Wed Jul 31 20:13:04 2013):

  The system is going down for reboot NOW!
  [root@localhost sbin]#

  检测板卡硬件
  执行以下命令,检查板卡状态,先执行命令 :wanrouter start, 然后执行以下命令:
  [root@localhost ~]# wanrouter hwprobe

  -------------------------------
  | Wanpipe Hardware Probe Info |
  -------------------------------
  1 . AFT-A400-SH�0�2: SLOT=4�0�2: BUS=3�0�2: IRQ=5�0�2: CPU=A�0�2: PORT=PRI�0�2: HWEC=0�0�2: V=11

  Sangoma Card Count: A200=1

  [root@localhost ~]#
  [root@localhost bin]# wanrouter status

  Devices currently active:
  wanpipe1

  Wanpipe Config:

  Device name | Protocol Map | Adapter | IRQ | Slot/IO | If's | CLK | Baud rate |
  wanpipe1 | N/A | A200/A400/B600/B700/B800/B610| 169 | 4 | 1 | N/A | 0 |

  Wanrouter Status:

  Device name | Protocol | Station | Status |
  wanpipe1 | A-ANALOG | N/A | Connected |

  [root@localhost bin]#

  检查配置freetdm.conf文件
  这是FreeTDM 配置文件.
  编辑:/usr/local/freeSWITCH/conf/freetdm.conf 文件
  [span wanpipe FXO]
  name => freetdm
  trunk_type => fxo
  group => grp2
  fxo-channel => 1:7
  number => 29193553 // 必须设置线路电话号码

  trunk_type => fxo
  group => grp2
  fxo-channel => 1:8
  number => 29193554 // 必须设置线路电话号码

  编辑/usr/local/freeswitch/conf/tones.conf�0�2文件,添加支持中国忙音,拨号音
  [cn]
  generate-dial => v=-7;%(1000,0,450)
  detect-dial => 450
  generate-ring => v=-7;%(1000,4000,460)
  detect-ring => 460
  generate-busy => v=-7;%(350,350,460)
  detect-busy => 460
  generate-attn => v=0;%(100,100,1400,2060,2450,2600)
  detect-attn => 460
  generate-callwaiting-sas => v=0;%(300,0,440)
  detect-callwaiting-sas => 460
  generate-callwaiting-cas => v=0;%(80,0,2750,2130)
  detect-callwaiting-cas => 460
  detect-fail1 => 913.8
  detect-fail2 => 1370.6
  detect-fail3 => 1776.7
  编辑freetdm.conf.xml
  autoload_configs/freetdm.conf.xml
  <configuration name="freetdm.conf" description="FreeTDM Configuration">
  <settings>
  <param name="debug" value="4"/>
  <param name="hold-music" value="$$moh_uri"/>
  </settings>
  <!-- one entry here per freetdm span -->
  <analog_spans>
  <span name="FXS">
  <!-- This is where the calls coming on this sapn will be directed -->
  <param name="dialplan" value="XML"/>
  <param name="context" value="fxs-ports"/>
  <param name="enable_callerid" value="true"/> <!-- This is the default value anyway -->
  </span>
  <span name="FXO">
  <param name="dialplan" value="XML"/>
  <param name="context" value="public"/>
  <!-- Set this to the correct value for your area, to get the
  correct tones on the phones connected to the FXS ports -->
  <param name="tonegroup" value="cn"/> // 设置到中国制式
  <param name="enable_callerid" value="true"/>
  </span>
  </analog_spans>
  </configuration>

  在默认的FreeSWITCH 启动模块中添加添加freetdm 模块
  编辑文件 vi /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml 删除注释,确认freetdm 模块已经被添加
  <load module="mod_freetdm"/>

  检查ftdm 模块加载状态
  运行 fs_cli 命令,进入到freeSWITCH CLI
  freeswitch@internal> ftdm list
  +OK
  span: 1 (FXO)
  type: analog
  physical_status: ok
  signaling_status: UP
  chan_count: 2
  dialplan: XML
  context: public
  dial_regex:
  fail_dial_regex:
  hold_music:
  analog_options: none
  freeswitch@internal> ftdm dump 1 1
  span_id: 1 // 逻辑组
  chan_id: 1 // 逻辑端口,呼入呼出的拨号规则中使用此端口
  physical_span_id: 1 // 物理组
  physical_chan_id: 7 // 物理端口位置
  physical_status: ok
  physical_status_red: 0
  physical_status_yellow: 0
  physical_status_rai: 0
  physical_status_blue: 0
  physical_status_ais: 0
  physical_status_general: 0
  signaling_status: UP
  type: FXO
  state: DOWN
  last_state: HANGUP
  txgain: 0.00
  rxgain: 0.00
  cid_date:
  cid_name:
  cid_num:
  ani:
  aniII:
  dnis:
  rdnis:
  cause: NONE
  session: (none)

  -- States -- -- Function -- -- Location -- -- Time Offset --
  RING => HANGUP [channel_on_hangup] [mod_freetdm.c:590] 0ms
  HANGUP => DOWN [ftdm_analog_channel_run] [ftmod_analog.c:562] 515ms
  DOWN => DIALING [analog_fxo_outgoing_call] [ftmod_analog.c:62] 161968ms
  DIALING => UP [ftdm_analog_channel_run] [ftmod_analog.c:509] 7900ms
  UP => HANGUP [channel_on_hangup] [

  确认freetdm 模块已经加载。

freeswitch windows安装

FreeSWITCH 是一个电话的软交换解决方案,包括一个软电话和软交换机用以提供语音和聊天的产品驱动。FreeSWITCH 可以用作交换机引擎、PBX、多媒体网关以及多媒体服务器等 

安装包下载:https://files.freeswitch.org/windows/installer/

 代码下载:https://github.com/signalwire/freeswitch

 

以上是关于如何在FreeSWITCH开源软交换安装Sangoma-A400模拟卡的主要内容,如果未能解决你的问题,请参考以下文章

如何在FreeSWITCH开源软交换安装Sangoma-A400模拟卡

freeswitch windows安装

freeswitch可以把手机电话转成voip吗

freeswitch简介

基于Django 的 FreeSwitch 开源GUI 管理系统 YouPBX

frfreeswitch 怎么通过c修改.xml