centos7安装FreeSwitch,以及设置Freeswitch开机自启

一.     下载指定版本的freeswitch

cd /usr/local/src
git clone --branch v1.10.7 https://github.com/signalwire/freeswitch.git

 也可以下载1.10.7的压缩包

二.       进入freeswitch目录

cd /usr/local/src/freeswitch

三.Sofia sip和SpanDSP依赖项已从FreeSWITCH中删除™ 自v1.10.4发布(2020年8月5日)以来。所以要先下载编译这两个依赖

cd /usr/local/src/freeswitch
git clone https://github.com/freeswitch/sofia-sip
cd sofia-sip
./configure
make
make install
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}
ldconfig


git clone https://github.com/freeswitch/spandsp
./bootstrap.sh -j
./configure
make
make install
ldconfig

四. 修改module.conf

由于freeswitch支持动态编译和动态加载,一些不需要的模块可以不编译,如:mod_signalwire、mod_av,修改方法

找到module.conf文件,找到mod_signalwire和mod_av注释掉,修改如下(注意:步骤五中执行完./bootstrap.sh后才会出来):

#applications/mod_signalwire
#applications/mod_av
#applications/mod_verto

五.编译freeswitch

cd /usr/local/src/freeswitch
./bootstrap.sh
./configure --enable-portable-binary --prefix=/usr/local/freeswitch --with-gnu-ld --with-python --with-openssl --enable-core-odbc-support --enable-zrtp
make
make install

六.启动freeswitch

cd /usr/local/freeswitch/bin
./freeswitch -nonat

 1.启动成功:如下

 2.设置防火墙【如els调用】

修改配置文件

vi /etc/firewalld/zones/public.xml

<service name="dhcpv6-client"/>后直接添加:
<port protocol="tcp" port="8021"/>
重启服务

firewall-cmd --reload

查看端口
 

firewall-cmd --list-ports

七.设置开机自启

 1、在目录/usr/lib/systemd/system下创建文件freeswitch.service,内容如下:

[Unit]
Description=FreeSWITCH
After=syslog.target network.target
After=postgresql.service postgresql-9.3.service postgresql-9.4.service mysqld.service httpd.service

[Service]
User=root
EnvironmentFile=-/etc/sysconfig/freeswitch
WorkingDirectory=/usr/local/freeswitch
ExecStart=/usr/local/freeswitch/bin/freeswitch -nc -nf $FREESWITCH_PARAMS 
ExecReload=/usr/bin/kill -HUP $MAINPID
#ExecStop=/usr/local/freeswitch/bin/freeswitch -stop $FREESWITCH_PARAMS
ExecStop=/bin/kill -9 $MAINPID


[Install]
WantedBy=multi-user.target

2、在目录/etc/sysconfig下创建文件freeswitch,内容如下:

## Type:                string
## Default:             ""
## Config:              ""
## ServiceRestart:      freeswitch
#
# if not empty: parameters for freeswitch
#
FREESWITCH_PARAMS=""

3、修改

cd /usr/local/
chown -R root:root freeswitch
chmod -R g+w freeswitch

4、启动

开机启动:systemctl enable freeswitch.service
启动服务:systemctl start freeswitch.service
结束服务:systemctl stop freeswitch.service

八.遇到的问题

   有时间再补充到这里

   1.报错一:./autogen.sh: line 6: autoreconf: command not found

yum  -y  install autoconf automake libtool

   2.错误二:make的时候报错------collect2: error: ld returned 1 exit status
                     make[2]: *** [sip-options] Error 1

                     可能一些依赖包没有安装可以执行下面的命令进行安装     

yum install -y epel-release
yum install -y yum-plugin-ovl centos-release-scl rpmdevtools yum-utils git wget vim devtoolset-7-gcc* devtoolset-7 libtiff-devel cmake3 libatomic unixODBC unixODBC-devel.x86_64 postgresql-libs postgresql-devel libpqxx-devel
yum install -y gcc-c++ autoconf automake libtool ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel libxml2-devel libyuv-devel libvpx-devel libvpx2* libdb4* libidn-devel unbound-devel libuuid-devel lua-devel libsndfile-devel yasm-devel

      3.错误三:hecking for spandsp >= 3.0... configure: error: no usable spandsp; please                         install  spandsp3 devel package or equivalent

                        查看下安装spandsp的时候有没有报错

     4.错误四:make: *** [libs/libvpx/Makefile] 错误 1         

               vi src/mod/codecs/mod_opus/Makefile

               # 注释掉以下内容

                #install: error

               #all: error

                注释完之后直接make 不要再./configure了,不然注释内容又恢复了

                还不灵的话 最后注释掉了 mod_opus模块

    5.错误五:od_spandsp_dsp.c: 在函数‘get_v18_mode’中:
mod_spandsp_dsp.c:159:10: 错误:‘V18_MODE_5BIT_4545’未声明(在此函数内第一次使用)

             参考:下边连接解决https://blog.youkuaiyun.com/zzhongcy/article/details/131693811icon-default.png?t=N7T8https://blog.youkuaiyun.com/zzhongcy/article/details/131693811

     6.错误六:手动安装opus报错 make: *** [aclocal.m4] 错误 127

           先执行 autoreconf -ivf 加载缺失文件 后 再执行 make就可以了

注:如果缺依赖则yum install或者源码安装,如果依赖包的版本过低,则先yum remove卸载后重新安装高版本即可。
  这种依赖问题没有捷径,非要说的话有两点:保持耐心 + 仔细看报错信息,

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值