SIP - FreeSwitch 安装 & 编译

本文详细介绍了如何在Windows和CentOS系统上安装FreeSWITCH,包括MSI和RPM方式,并指导了源代码编译过程,涉及库的构建和FreeSWITCH配置实例,适合开发者进行电话软交换平台搭建与调试。

SIP - FreeSwitch 安装 & 编译

FreeSWITCH是一个开源的电话软交换平台, 这里不做详细介绍, 只用于编译&安装测试 SIP 协议.
FreeSWITCH Installation

Windows MSI 安装

https://files.freeswitch.org/windows/installer/x64/
https://files.freeswitch.org/windows/installer/x64/sounds/

CentOS 7 RPM 安装

$ yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release
$ yum install -y freeswitch-config-vanilla freeswitch-lang-* freeswitch-sounds-*
$ systemctl enable freeswitch
$ systemctl start freeswitch

CentOS 8 RPM 安装

需使用第三方 okay repo:

$ rpm -ivh http://repo.okay.com.mx/centos/8/x86_64/release/okay-release-1-5.el8.noarch.rpm

or 手动添加repo

[okay]
name=Extra OKay Packages for Enterprise Linux - $basearch
baseurl=http://repo.okay.com.mx/centos/$releasever/$basearch/release
failovermethod=priority
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OKAY

[okay-debuginfo]
name=Extra OKay Packages for Enterprise Linux - $basearch - Debug
baseurl=http://repo.okay.com.mx/centos/$releasever/$basearch/debug
failovermethod=priority
enabled=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OKAY
gpgcheck=0

安装:

$ yum install fusionpbx-all
$ freeswitch -version
FreeSWITCH version: 1.10.3-release~64bit (-release 64bit)

FreeSwitch源代码编译安装

注:
建议使用 fedora, CentOS 8 很多的依赖库需要自行编译;

先安装 libks & signalwire

build libks

$ git clone https://github.com/signalwire/libks 
$ cd libks && cmake . && make -j install

build signalwire

$git clone https://github.com/signalwire/signalwire-c
$ cd signalwire-c && cmake . && make -j install

build FreeSwitch

$ dnf install -y git alsa-lib-devel autoconf automake bison bzip2 curl-devel e2fsprogs-devel flite-devel \
gcc-c++ gdbm-devel gnutls-devel ldns-devel libcurl-devel libedit-devel libidn-devel libjpeg-devel libmemcached-devel \
libogg-devel libsndfile-devel libtheora-devel libtiff-devel libtool libuuid-devel libvorbis-devel libxml2-devel \
lua-devel lzo-devel mongo-c-driver-devel ncurses-devel net-snmp-devel nspr-devel openssl-devel opus-devel pcre-devel perl \
perl-ExtUtils-Embed pkgconfig portaudio-devel postgresql-devel python2-devel python-devel soundtouch-devel \
speex-devel sqlite-devel unbound-devel unixODBC-devel wget which yasm zlib-devel speexdsp-devel speex-devel erlang libvpx-devel
 
$ git clone -b v1.8 https://github.com/signalwire/freeswitch.git freeswitch
$ cd freeswitch
$ export CFLAGS="-Wno-error=format-truncation -Wno-error=stringop-truncation"
$ ./bootstrap.sh -j

$ PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig \
./configure -C --enable-portable-binary \
            --prefix=/usr --localstatedir=/var --sysconfdir=/etc \
            --with-gnu-ld --with-python --with-erlang --with-openssl \
            --enable-core-odbc-support --enable-zrtp \
            --enable-core-pgsql-support \
            --enable-static-v8 --disable-parallel-build-v8
$ find . -name Makefile -exec sed -i "s/-Werror //g" {} ';'
$ make
$ make -j install
$ make -j cd-sounds-install
$ make -j cd-moh-install

启动:

$ /usr/bin/freeswitch -nc 

停止:

$ /usr/bin/freeswitch -stop

日志

tail -f /var/log/freeswitch/freeswitch.log

FreeSWITCH 配置

创建用户

cd /etc/freeswitch/directory/default
cp 1000.xml 9999.xml
sed -i "s/1000/9999/" 9999.xml
vi /etc/freeswitch/dialplan/default.xml 
修改
expression="^(10[012][0-9]|9999)$"

批量添加用户

cd /etc/freeswitch/directory/default
for i in `seq 1020 1039`; do sed -e "s/1000/$i/" 1000.xml > $i.xml ; done

注: FreeSwitch 账户默认密码为 '1234’

默认拨号

numberExplanation
9664Keep music
9191Sign up for ClueCon
9195echo, echo test, delay 5 seconds
9196echo, echo test, no delay
9197milliwatte extension, ringtone generation
9198TGML ringtone generation example
9180Ring tone test, using the ring back tone generated by the far end
9181Ring tone test, produce British ring tone
9182Ring tone test, use music as ring tone, ring back tone
9183Answer first, then send an English ring tone
9184Answer first, then send music ringtone
9178Receive fax
9179send a fax
5000IVR demo
4000Voicemail de2021/8/4mo
33xxConference call, 48kHz
32xxConference call, 32kHz
31xxConference call, 16kHz
30xxConference call, 8kHz
2000~2002Call group
1000~1019Default extension

fs_cli

reloadxml 重新加载XML配置

fs_cli -x reloadxml

获取 profile 状态

freeswitch@centos7-170> sofia status profile external 
=================================================================================================
Name             	external
Domain Name      	N/A
Auto-NAT         	false
DBName           	sofia_reg_external
Pres Hosts       	
Dialplan         	XML
Context          	public
Challenge Realm  	auto_to
RTP-IP           	192.168.22.170
Ext-RTP-IP       	118.249.190.28
SIP-IP           	192.168.22.170
Ext-SIP-IP       	118.249.190.28
URL              	sip:mod_sofia@118.249.190.28:5080
BIND-URL         	sip:mod_sofia@118.249.190.28:5080;maddr=192.168.22.170;transport=udp,tcp
HOLD-MUSIC       	local_stream://moh
OUTBOUND-PROXY   	N/A
CODECS IN        	OPUS,G722,PCMU,PCMA,H264,VP8
CODECS OUT       	OPUS,G722,PCMU,PCMA,H264,VP8
TEL-EVENT        	101
DTMF-MODE        	rfc2833
CNG              	13
SESSION-TO       	0
MAX-DIALOG       	0
NOMEDIA          	false
LATE-NEG         	true
PROXY-MEDIA      	false
ZRTP-PASSTHRU    	true
AGGRESSIVENAT    	false
CALLS-IN         	0
FAILED-CALLS-IN  	0
CALLS-OUT        	0
FAILED-CALLS-OUT 	0
REGISTRATIONS    	0

softphone 客户端

  • freeswitch 注册 5060 端口需使用密码验证注册;
  • freeswitch 注册 5080 端口无需验证注册;
  • softphone 注册成功后拨打 9664 响应音乐即验证INVITE成功;

JitSiDesktop

https://jitsi.org/projects/
在这里插入图片描述
在这里插入图片描述

microsip

https://www.microsip.org/
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值