FreeSWITCH 1.6.12 安装笔记(apt

Stella981
• 阅读 848

2016-11-1

上周折腾了2天,安装升级了 FreeSWITCH 最新版本 1.6.12,把步骤记录一下以备后续查看。

1) 查看系统版本 on Debian

$ uname -a
Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.6 (jessie)
Release:        8.6
Codename:       jessie

# on Debian
$ cat /etc/debian_version 
8.6

# on CentOS
cat /etc/centos-release
CentOS release 6.6 (Final)

# 查看当前主机信息
# For systemd Debian version you may also use hostnamectl:
hostnamectl

apt-get update
apt-get install sox
apt-get install lsb-release
apt-get install ngrep
apt-get install subversion
apt-get install lrzsz
apt-get install python
apt-get install python-dev
apt-get install python-mysqldb

2) 使用 apt-get 方式进行安装,通过这种方式安装,就是下载别人已编译打包好的代码,进行安装部署,减少自己编译需要解决很多依赖包的麻烦。

【注意】

  1. 如果 FS 官网挂了,这种安装方式也会受到影响,部分东西仍是需要到 FS 官网上进行下载的
  2. 通过 apt-get 方式安装的 FS 不包括 mod_shout 模块

https://freeswitch.org/confluence/display/FREESWITCH/Debian+8+Jessie

https://freeswitch.org/confluence/display/FREESWITCH/Debian+Post-Install+Tasks

参考官方的安装文档 Installing from Debian packages

wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -

echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list

# you may want to populate /etc/freeswitch at this point.
# if /etc/freeswitch does not exist, the standard vanilla configuration is deployed

apt-get update && apt-get install -y freeswitch-meta-all && apt-get install -y freeswitch-meta-all-dbg

通过以下命令,可以查找到和 FreeSWITCH 相关的所有 packages:

apt-cache search freeswitch

单独安装 mod_shout 模块:

apt-cache search freeswitch-mod-shout

apt-get install -y freeswitch-mod-shout && apt-get install -y freeswitch-mod-shout-dbg

3) apt-get 的安装日志,位于

tail -f /var/log/apt/history.log

4) 安装完成之后,FS 会自动启动,无论使用 /usr/bin/freeswitch -stop 或者 kill 都退出不了进程,因为它是通过 systemd 来启动的,需要使用如下命令才能正确退出 FS:

systemctl stop freeswitch.service

systemctl 其实是调用了一个脚本来启动 FS 的,可以通过以下命令找到该脚本:

find / -name "*freeswitch.service*"

# 查找结果,第一个结果其实是软链接,指向第二个结果的
/etc/systemd/system/multi-user.target.wants/freeswitch.service
/lib/systemd/system/freeswitch.service

FS 源码里面包含了这个脚本的:

https://freeswitch.org/stash/projects/FS/repos/freeswitch/browse/debian/freeswitch-systemd.freeswitch.service

该启动脚本配置了很多启动参数,可以对这些参数进行调整,但一般不建议直接修改这个脚本,自定义的启动参数可以另外配置在以下位置:

;;;;; Author: Travis Cross <tc@traviscross.com>

[Unit]
Description=freeswitch
After=syslog.target network.target local-fs.target

[Service]
; service
Type=forking
PIDFile=/run/freeswitch/freeswitch.pid
Environment="DAEMON_OPTS=-nonat"
EnvironmentFile=-/etc/default/freeswitch
ExecStart=/usr/bin/freeswitch -u freeswitch -g freeswitch -ncwait $DAEMON_OPTS
TimeoutSec=45s
Restart=always
; exec
User=root
Group=daemon
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
LimitSTACK=250000
LimitRTPRIO=infinity
LimitRTTIME=infinity
IOSchedulingClass=realtime
IOSchedulingPriority=2
CPUSchedulingPolicy=rr
CPUSchedulingPriority=89
UMask=0007

; 这里新建一个 conf 文件
; alternatives which you can enforce by placing a unit drop-in into
; /etc/systemd/system/freeswitch.service.d/*.conf:
;
; User=freeswitch
; Group=freeswitch
; ExecStart=
; ExecStart=/usr/bin/freeswitch -ncwait -nonat -rp
;
; empty ExecStart is required to flush the list.
;
; if your filesystem supports extended attributes, execute
;   setcap 'cap_net_bind_service,cap_sys_nice=+ep' /usr/bin/freeswitch
; this will also allow socket binding on low ports
;
; otherwise, remove the -rp option from ExecStart and
; add these lines to give real-time priority to the process:
;
; PermissionsStartOnly=true
; ExecStartPost=/bin/chrt -f -p 1 $MAINPID
;
; 新建完之后,需要 reload 配置文件
; execute "systemctl daemon-reload" after editing the unit files.

5) 通过 systemctl 来启动、关闭、重启 FS:

# 立即启动
$ systemctl start freeswitch.service

# 立即停止
$ systemctl stop freeswitch.service

# 重启
$ systemctl restart freeswitch.service

# 杀死 FS 服务进程及其所有子进程
$ systemctl kill freeswitch.service

查看 FS 启动日志:

# 查看某个 Unit 的日志
$ journalctl -u freeswitch.service
$ journalctl -u freeswitch.service --since today

# 实时滚动显示某个 Unit 的最新日志
$ journalctl -u freeswitch.service -f
$ journalctl -u freeswitch.service -f -n 100

6) 安装完成后,执行命令确保需要的模块已经正常安装、加载:

fs_cli > module_exists mod_curl
fs_cli > module_exists mod_xml_curl
fs_cli > module_exists mod_xml_rpc
fs_cli > module_exists mod_event_socket
fs_cli > module_exists mod_shout
fs_cli > module_exists mod_python
fs_cli > module_exists mod_lua
fs_cli > module_exists mod_cdr_csv
fs_cli > module_exists mod_tts_commandline
fs_cli > module_exists mod_flite
fs_cli > module_exists mod_pocketsphinx
fs_cli > module_exists mod_opus
fs_cli > module_exists mod_unimrcp
fs_cli > module_exists mod_redis

# 直接查看模块是否已经编译生成
$ ll -lh /usr/lib/freeswitch/mod/

【注意】

  1. 通过 apt-get 方式安装 FS ,默认不安装 mod_shout 模块的,需要自己手动安装。
  2. 这些模块不一定全都是你所需要的,比如,我自己用了 lua 和 python,就需要 mod_luamod_python 这两模块;模块 mod_shout 是对 mp3 文件做支持的,如果需要播放 mp3 音频文件或者录音为 mp3 格式的文件,就需要该模块。

7) 使用 apt-get 方式安装 FS,安装完成后它的相关文件夹会比较分散,使用以下命令可以查找到以 freeswitch命名的文件夹:

find / -name freeswitch -type d

# 查找结果
/run/freeswitch
/var/log/freeswitch
/var/lib/freeswitch
/usr/share/doc/freeswitch
/usr/share/perl5/auto/freeswitch
/usr/share/freeswitch
/usr/local/freeswitch
/usr/lib/freeswitch
/etc/freeswitch

8) 设置 core dump file 的文件命名规则,当 FS 崩溃的时候,会在【 根路径/ 下生成 core dump file

# 查看系统变量
sysctl kernel.core_pattern

# 写入系统变量
sysctl -w kernel.core_pattern=core.%e.%h.%p

9) 查找 fs 崩溃的时候,生成的 core file

find /home -name *core*

至此,全部安装已经完成,可以开始使用你的 FreeSWITCH 了 ^_^

# 启动(如果服务是运行中状态,会启动失败)
systemctl start freeswitch.service

# 关闭
systemctl stop freeswitch.service

# 运行状态
systemctl status freeswitch.service

# 查看启动配置
systemctl can freeswitch.service

# 开启开机启动
systemctl enable freeswitch.service

# 取消开机启动
systemctl disable freeswitch.service

# 查看运行中的服务
systemctl list-units --type=service

【参考】

https://freeswitch.org/confluence/display/FREESWITCH/Debian+8+Jessie

http://blog.jobbole.com/107760/

https://en.wikipedia.org/wiki/Core_dump

http://man7.org/linux/man-pages/man5/core.5.html

http://man.linuxde.net/sysctl/

http://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-commands.html

http://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-part-two.html

点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Easter79 Easter79
2年前
swap空间的增减方法
(1)增大swap空间去激活swap交换区:swapoff v /dev/vg00/lvswap扩展交换lv:lvextend L 10G /dev/vg00/lvswap重新生成swap交换区:mkswap /dev/vg00/lvswap激活新生成的交换区:swapon v /dev/vg00/lvswap
Jacquelyn38 Jacquelyn38
2年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Wesley13 Wesley13
2年前
Java获得今日零时零分零秒的时间(Date型)
publicDatezeroTime()throwsParseException{    DatetimenewDate();    SimpleDateFormatsimpnewSimpleDateFormat("yyyyMMdd00:00:00");    SimpleDateFormatsimp2newS
Wesley13 Wesley13
2年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
2年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
2年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
3个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这