freeswitch centos,wsl centos

freeswitch简介

freeswitch是开源的,免费的。

freeswitch是一款非常好用的电话软交换框架,支持跨平台,扩展性良好,配置灵活。

freeswitch可以在很多平台上运行,包括Linux、Mac OS X、BSD、Solaris,甚至Windows。

freeswitch目前最新版本是1.10,常用版本有1.6和1.8。

freeswitch可以处理来自IP网络(VoIP)和PSTN(普通的固定电话)的语音、视频和文本通信。

freeswitch支持所有流行的VoIP协议以及与PRIs的接口。

freeswitch支持OPUS、iLBC、Speex、GSM、G711、G722等多种语音编解码,支持G723、G729等语音编解码的透传模式。

freeswitch可以当作PBX、SBC、媒体服务器、业务服务器等不同的通信节点来使用

freeswitch本身是在MPL1.1(Mozilla公共许可证)下许可的,但是一些单独的模块可能使用其他许可证。

centos:CentOS

release 7.0(Final)或以上版本

freeswitch:v1.8.7

GCC:4.8.5

freeswitch的conf目录中有10个默认的sip账号,可以直接做简单的测试

eyebeam、X-Lite、linphone等有sip注册功能的客户端软件

user:1001、1002

password:默认为1234

domain:192.168.0.110:5060

使用俩个客户端注册成功后,互拨测试

空空如常

求真得真

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

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配置SBC实例

freeswitch是一款广受欢迎的开源软交换平台,其在voip客户发展与运营商网络升级换代背景下,SBC的应用场景日益增多。配置SBC实例时,只需简单安装freeswitch即可满足大部分功能需求。这里提供fs-sbc稳定版本的安装与配置步骤,以fs作为SBC的基本配置。

安装环境要求为CentOS版本7及以上,使用GCC 4.8.5进行fs1.10.7的编译安装。

对于fs1.10.7的安装过程和配置指南,建议参考文档“freeswitch1.10.7 on CENTOS7编译安装”。完成基础平台的安装后,进入fs-sbc的初始配置方案。

移除不必要的fs配置文件及bin脚本。fs的bin目录下应保留一些基本维护脚本。

防火墙配置至关重要。具体配置结果需根据实际情况调整。

fs作为SBC,其安全性是首要考虑因素。fs的基础功能已基本能满足SBC的需求,通过简单配置即可投入使用。

作为公私网信令与媒体通道,SBC的安全性至关重要。fs在系统配置上应保持简洁,确保功能稳定与高效。

总结,fs-sbc的配置需注重细节,特别是防火墙与安全配置。fs的基础功能已足够应对SBC的日常需求,配置时需确保系统稳定,避免不必要的复杂性。

阅读剩余
THE END