freeswtich+homer+sngrep 搭建sip监控系统

# 一、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页面观察接收到的信令情况

 

Master the art of advanced VoIP and WebRTC communication with the most dynamic application server, FreeSWITCH About This Book Forget the hassle - make FreeSWITCH work for you Discover how FreeSWITCH integrates with a range of tools and APIs From high availability to IVR development use this book to become more confident with this useful communication software Who This Book Is For SysAdmins, VoIP engineers – whoever you are, whatever you’re trying to do, this book will help you get more from FreeSWITCH. What You Will Learn Get to grips with the core concepts of FreeSWITCH Learn FreeSWITCH high availability Work with SIP profiles, gateways, ITSPs, and Codecs optimization Implement effective security on your projects Master audio manipulation and recording Discover how FreeSWITCH works alongside WebRTC Build your own complex IVR and PBX applications Connect directly to PSTN/TDM Create your own FreeSWITCH module Trace SIP packets with the help of best open source tools Implement Homer Sipcapture to troubleshoot and debug all your platform traffic In Detail FreeSWITCH is one of the best tools around if you’re looking for a modern method of managing communication protocols through a range of different media. From real-time browser communication with the WebRTC API to implementing VoIP (voice over internet protocol), with FreeSWITCH you’re in full control of your projects. This book shows you how to unlock its full potential – more than just a tutorial, it’s packed with plenty of tips and tricks to make it work for you. Written by members of the team who actually helped build FreeSWITCH, it will guide you through some of the newest features of version 1.6 including video transcoding and conferencing. Find out how FreeSWITCH interacts with other tools and APIs, learn how to tackle common (and not so common) challenges ranging from high availability to IVR development and programming advanced PBXs. Great communication functionality begins with FreeSWITCH – find out how and get your project up and running today. Style and approach Find out how it works, then put your knowledge into practice - that's how this advanced FreeSWITCH guide has been designed to help you learn. You'll soon master FreeSWITCH and be confident using it in your projects. Table of Contents Chapter 1: Typical Voice Uses for FreeSWITCH Chapter 2: Deploying FreeSWITCH Chapter 3: ITSP and Voice Codecs Optimization Chapter 4: VoIP Security Chapter 5: Audio File and Streaming Formats, Music on Hold, Recording Calls Chapter 6: PSTN and TDM Chapter 7: WebRTC and Mod_Verto Chapter 8: Audio and Video Conferencing Chapter 9: Faxing and T38 Chapter 10: Advanced IVR with Lua Chapter 11: Write Your FreeSWITCH Module in C Chapter 12: Tracing and Debugging VoIP Chapter 13: Homer, Monitoring and Troubleshooting your Communication Platform
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值