User-Profile-Image
hankin
  • 5
  • centos7
  • docker
  • mysql
  • PostgreSQL
  • git/gitlab
  • ELK
  • python
    • python-Tornado
    • python-django
  • redis
  • nginx
  • kvm
  • proxmox
  • mongo
  • kubernetes
  • prometheus
  • GlusterFs
  • nfs
  • freeswitch
  • httpd
  • shell脚本
  • linux
  • fastdfs
  • nextcloud
  • openssl
  • openvpn
  • rabbitmq
  • sqlite
  • svn
  • java
  • ubuntu
  • vue2
  • wordpress
  • php
  • IOT物联网
  • 项目
  • 故障处理
  • 树莓派
  • 博客存档
  • 未分类
  • 杂项
  • #1742(无标题)
  • 新视野
  • 分类
    • 项目
    • 树莓派
    • 杂项
    • 未分类
    • 新视野
    • 故障处理
    • 博客存档
    • 交换机
    • wordpress
    • vue2
    • ubuntu
    • svn
    • sqlite
    • shell脚本
    • redis
    • rabbitmq
    • python-django
    • python
    • proxmox
    • prometheus
    • PostgreSQL
    • php
    • openvpn
    • openssl
    • nginx
    • nfs
    • nextcloud
    • mysql
    • mongo
    • linux
    • kvm
    • kubernetes
    • java
    • IOT物联网
    • httpd
    • GlusterFs
    • git/gitlab
    • freeswitch
    • fastdfs
    • ELK
    • docker
    • centos7
  • 页面
    • #1742(无标题)
  • 友链
      请到[后台->主题设置->友情链接]中设置。
Help?

Please contact us on our email for need any support

Support
    首页   ›   freeswitch   ›   正文
freeswitch

centos7编译安装freeswitch软电话交换软件并实现通话

2022-10-28 23:33:22
886  0 0

centos7编译安装freeswitch,并实现通话

环境

centos7.9(最小安装的)

freeswitch1.10.5源码

安装

编译环境安装

由于centos7使用最小安装,需要安装的软件有点多

yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release

yum install -y yum-utils --enablerepo=extras

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  python 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
下载准备源码文件

由于github官网不能稳定访问 此处使用镜像网址github.com.cnpmjs.org,也可通过其他途径下载源码文件

cd /usr/local/src       
git clone -b v1.10.5 https://github.com.cnpmjs.org/signalwire/freeswitch.git freeswitch
cd /usr/local/src/freeswitch            
git clone https://github.com.cnpmjs.org/freeswitch/spandsp.git      
git clone https://github.com.cnpmjs.org/freeswitch/sofia-sip.git        
git clone https://github.com.cnpmjs.org/signalwire/libks.git
编译安装
#安装libks    
cd /usr/local/src/freeswitch/libks      
cmake3 .        
make -j32       
make install -j32

#安装spandsp  
cd /usr/local/src/freeswitch/spandsp        
./bootstrap.sh -j32 
./configure     
make -j32   
make install -j32       
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}   

ldconfig

#安装sofia    
cd /usr/local/src/freeswitch/sofia-sip      
./bootstrap.sh -j32 
./configure     
make -j32       
make install -j32   
ldconfig

cd /usr/local/src/freeswitch        
./bootstrap.sh -j32 
vim modules.conf    
    #根据需要注释不需要的功能

./configure --enable-portable-binary  --prefix=/opt/freeswitch-test  --with-gnu-ld  --with-python  --with-openssl  --enable-core-odbc-support  --enable-zrtp    
make -j32   
make install -j32

启动测试

#启动
/opt/freeswitch/bin/freeswitch
/opt/freeswitch/bin/freeswitch -nc #后台启动

#客户端连接
/opt/freeswitch/bin/fs_cli

注册

注册-做为落地网关

以注册到vos落地为例

1 vos新建动态落地,并记录网关名称和配置密码

2 新建freeswitch配置文件
cat /opt/freeswitch/etc/freeswitch/sip_profiles/external/test.xml
  <include>
  <gateway name="test01">
  <param name="username" value="test01"/>
  <param name="realm" value="192.168.1.2:8000"/>
  <param name="from-user" value="test01"/>
  <param name="from-domain" value="192.168.1.2:8000"/>
  <param name="password" value="此处为配置密码"/>
  <param name="extension-in-contact" value="true"/>
  <param name="register" value="true"/>
  <param name="expire-seconds" value="3600"/>
  </gateway>
  </include>

  cat /opt/freeswitch/etc/freeswitch/sip_profiles/external.xml
  如下部分需要自定义:
    <param name="context" value="external-xxx"/>
    <param name="rtp-ip" value="192.168.2.3"/>
    <param name="sip-ip" value="192.168.2.3"/>
    <param name="ext-rtp-ip" value="stun:xxx"/>
    <param name="ext-sip-ip" value="stun:xxx"/>

3 启动fs,按f5并查看注册状态
如下,已正常注册到vos,

4 在拨号计划external-xxx中指定中继线路信息,即可将来自vos的呼叫送往指定线路。
cat /opt/freeswitch/etc/freeswitch/dialplan/ext.xml
<include>
    <context name="external_ctx">
    <extension name="out">
        <condition field="destination_number" expression="^(\d{8}|\d{10}|\d{11})$"/>
        <condition field="caller_id_number" expression="^18\d+$">
                        <action application="set" data="hangup_after_bridge=true"/>
                        <action application="bridge" data="{absolute_codec_string='PCMA',origination_caller_id_number=${caller_id_number}}sofia/gateway/${caller_id_number}/${destination_number}"/>
                        <action application="hangup"/>
        </condition>
    </extension>
    </context>
</include>
注册-做为对接网关

pass

git checkout -b finecode20230705 0d2e6ac65e0e8f53d652665a743015a88bf048d4
评论 (0)

点击这里取消回复。

欢迎您 游客  

Copyright © 2025 网站备案号 : 蜀ICP备2022017747号
smarty_hankin 主题. Designed by hankin
主页
页面
  • #1742(无标题)
博主
tang.show
tang.show 管理员
linux、centos、docker 、k8s、mysql等技术相关的总结文档
213 文章 2 评论 202115 浏览
测试
测试