# 一、freeswtich 1.10.6 安装
## 1、环境准备
- centos7.6 64 操作系统
- freeswtich 1.10.6 安装包
## 2、安装freeswtich
1.1 首先安装两个依赖库: Sofia-sip 和 spandsp,
说明国内的网络环境访问github不太稳定,可以经过海外主机下载 sofia-sip 和 spandsp 之后,打包拷贝到本地。
```
yum -y install autoconf automake git libtool openssl* libtiff* libjpeg*
git clone https://github.com/freeswitch/sofia-sip
cd sofia-sip
./bootstrap.sh
./configure
make
make install
git clone https://github.com/freeswitch/spandsp
cd spandsp
./bootstrap.sh
./configure
make
make install
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
```
1.2 安装 epel扩展和文件传输工具lrzsz及vim、安装相关依赖库
```
yum install -y epel-release lrzsz vim
yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm
yum-builddep -y freeswitch --skip-broken
yum install -y yum-plugin-ovl centos-release-scl rpmdevtools yum-utils
```
注意:
a. 在使用yum install的时候,偶尔会碰见这样的错误:Couldn’t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
这是因为在 /etc/yum.repos.d 目录下有关于yumrepository的配置文件中列有如下的GPG key:
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
而YUM在路径 /etc/pki/rpm-gpg 下找不到这个GPG key的时候,就会报如上的错误了。
解决方案:
```
cd /etc/pki/rpm-gpg
wget https://archive.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
```
然后再次运行 yum install 命令就可以成功了。
b. 执行 yum-builddep -y freeswitch 时候, 如果出现以下错误,说明 epel 源 访问有问题,请检查网络;
```
Error: No Package found for ldns-devel
Error: No Package found for libedit-devel
Error: No Package found for libmemcached-devel
Error: No Package found for libmpg123-devel >= 1.20.1
Error: No Package found for libogg-devel
Error: No Package found for libshout-devel >= 2.2.2
Error: No Package found for libtheora-devel
Error: No Package found for libvorbis-devel
Error: No Package found for lua-devel
Error: No Package found for speex-devel
```
3. 下载 freeswitch-1.10.6.-release.zip ,存放到 /home/fs/ 目录
4. 解压缩 freeswitch-1.10.6.-release.zip 并开始以下编译安装步骤:
```
cd /home/fs/unzip -d . freeswitch-1.10.6.-release.zip
cd freeswitch-1.10.6.-release
vim modules.conf #注释掉不需要的视频模块 mod_av 和 mod_signalwire export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./rebootstrap.sh -j
./configure
autoreconf -fiv
make
make install
```
5. 启动Freeswitch: /usr/local/freeswitch/bin/freeswitch -nonat -nosql
参考文档https://www.cnblogs.com/semaphore/p/15371450.html
# 二、安装homer
进入官方网站查找installinstall
```
https://github.com/sipcapture/homer/wiki/Quick-Install
yum install redhat-lsb-core wget curl git
wget https://github.com/sipcapture/homer-installer/raw/master/homer_installer.sh
chmod +x homer_installer.sh
./homer_installer.sh
注意 安装过程中有个文件遗漏了,注意下载下
telegraf.conf
https://github.com/sipcapture/homer-installer
```
# 三、安装 sngrep
安装sngrep
项目github地址:https://github.com/irontec/sngrep
安装
```
Debain
cat >> /etc/apt/sources.list <<-'EOF'
deb http://packages.irontec.com/debian squeeze main
deb http://packages.irontec.com/debian wheezy main
deb http://packages.irontec.com/debian jessie main
deb http://packages.irontec.com/debian stretch main
EOF
wget http://packages.irontec.com/public.key -q -O - | apt-key add -
apt-get update
apt-get install sngrep
```
ubuntu
```
cat >> /etc/apt/sources.list <<-'EOF'
deb http://packages.irontec.com/ubuntu trusty main
deb http://packages.irontec.com/ubuntu precise main
deb http://packages.irontec.com/ubuntu vivid main
deb http://packages.irontec.com/ubuntu xenial main
deb http://packages.irontec.com/ubuntu zesty main
deb http://packages.irontec.com/ubuntu artful main
EOF
wget http://packages.irontec.com/public.key -q -O - | apt-key add -
apt-get update
apt-get install sngrep
```
CentOS/RHEL
```
cat >> /etc/yum.repos.d/irontec.repo <<-'EOF'
[irontec]
name=Irontec RPMs repository
baseurl=http://packages.irontec.com/centos/$releasever/$basearch/
EOF
rpm --import http://packages.irontec.com/public.key
yum install -y sngrep
```
REHL
```
cat >> /etc/yum.repos.d/irontec.repo <<-'EOF'
[irontec]
name=Irontec RPMs repository
baseurl=http://packages.irontec.com/rhel/$releasever/$basearch/
EOF
rpm --import http://packages.irontec.com/public.key
```
yum install sngrep
# 四、启动检查
freeswtich
```
[root@localhost vagrant]# ps -ef |grep freeswitch
root 25722 1 4 17:19 ? 00:02:17 /usr/local/freeswitch/bin/freeswitch -nonat -nc
root 25763 25009 1 17:19 pts/2 00:00:34 /usr/local/freeswitch/bin/fs_cli
root 25910 25823 0 18:10 pts/4 00:00:00 grep --color=auto freeswitch
```
homer
```
[root@localhost ~]# ps -ef |grep homer
root 15643 1 0 15:01 ? 00:00:09 /usr/local/bin/homer-app
postgres 15695 15409 0 15:01 ? 00:00:02 postgres: homer_user homer_data ::1(53246) idle
postgres 16700 15409 0 18:05 ? 00:00:00 postgres: homer_user homer_config ::1(55702) idle
postgres 16710 15409 0 18:08 ? 00:00:00 postgres: homer_user homer_data 127.0.0.1(59042) idle
root 16719 4731 0 18:10 pts/1 00:00:00 grep --color=auto homer
[root@localhost ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 7384/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7079/sshd
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 15409/postmaster
tcp 0 0 127.0.0.1:8088 0.0.0.0:* LISTEN 14893/influxd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 7198/master
tcp6 0 0 :::9096 :::* LISTEN 15680/heplify-serve
tcp6 0 0 :::111 :::* LISTEN 7384/rpcbind
tcp6 0 0 :::8086 :::* LISTEN 14893/influxd
tcp6 0 0 :::22 :::* LISTEN 7079/sshd
tcp6 0 0 :::9080 :::* LISTEN 15643/homer-app
tcp6 0 0 :::3000 :::* LISTEN 15680/heplify-serve
tcp6 0 0 ::1:5432 :::* LISTEN 15409/postmaster
tcp6 0 0 :::8888 :::* LISTEN 14942/chronograf
tcp6 0 0 ::1:25 :::* LISTEN 7198/master
tcp6 0 0 :::9060 :::* LISTEN 15680/heplify-serve
tcp6 0 0 :::9092 :::* LISTEN 14933/kapacitord
```
http://172.0.2.11:9080/dashboard/registration
账号/密码: admin/sipcapture
sngrep
在freeswtich机器上面执行下面命令启动sngrep
```
sngrep portrange 5060-5080 -H udp:172.0.2.11:9060 --no-interface -q
```
# 五、拨打测试
eyebean 注册freeswitch 打入会议室3000,从homer页面观察接收到的信令情况