FreeSwitch的安装部署

FreeSwitch的版本历程

2006年-第一个版本
2008年-1.0凤凰版
2012年-Freeswitch 1.2
2014年-FreeSwitch 1.4       WebRTC
2015年-FreeSwitch 1.6       视频通话和视频会议
2017年-FreeSwitch 1.8
2019年-FreeSwitch 1.10
2020年-FreeSwitch 1.10.3

FreeSwitch的安装

从github仓库上下载freeswitch

# git clone https://github.com/signalwire/freeswitch.git
# cd freeswitch
# git checkout -b v1.10 remotes/origin/v1.10
# ./bootstrap.sh
# ./configure
# make
# make install

在执行 ./configure 的时候提示缺少如下库

please install spandsp3 devel package or equivalent

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

 checking for sofia-sip-ua >= 1.13.3... configure: error: no usable sofia-sip; please install

sofia-sip-ua devel package or equivalent

# git clone https://github.com/freeswitch/sofia-sip.gitcd sofia-sip
# ./bootstrap.sh -j
# ./configure
# make
# make install
# ldconfig

----------------以下错误出现在Ubuntu 18.04 系统上,未出现在Ubuntu 20.4 系统上-------------- 

You must install libks to build mod_signalwire.  Stop.  

# apt-get install uuid-dev
# git clone https://github.com/signalwire/libks.git
# cd libks
# cmake .
# make
# make install

You must install signalwire-client-c to build mod_signalwire.  Stop. 

# git clone https://github.com/signalwire/signalwire-c.git
# cd signalwire-c
# cmake .
# make
# make install

 FreeSwitch的使用

1、freeswitch配置文件中常用项

修改配置文件 /usr/local/freeswitch/conf/vars.xml

因为freeswitch很多安装在NAT网络环境中,需要设置extern_rtp_ip和external_sip_ip

<X-PRE-PROCESS cmd="set" data="external_rtp_ip=stun:stun.freeswitch.org"/>
<X-PRE-PROCESS cmd="set" data="external_sip_ip=stun:stun.freeswitch.org"/>

修改配置文件 /usr/local/freeswitch/conf/sip_profiles/internal.xml

因为freeswitch很多安装在NAT网络环境中,需要设置

<param name="aggressive-nat-detection" value="true"/>  取消注释开启
<param name="ext-rtp-ip" value="auto-nat"/>            设置相应stun地址
<param name="ext-sip-ip" value="auto-nat"/>            设置相应stun地址
<param name="NDLB-force-rport" value="true"/>          取消注释开启
<param name="inbound-proxy-media" value="true"/>      取消对应注释开启proxy模式
<!-- for sip over websocket support -->
<param name="ws-binding"  value=":5066"/>       开启WS

<!-- for sip over secure websocket support -->
<!-- You need wss.pem in $${certs_dir} for wss or one will be created for you -->
<!--<param name="wss-binding" value=":7443"/>-->   开启WSS,取消注释,需导入WSS.PEM证书

修改配置文件 /usr/local/freeswitch/conf/autoload_configs/switch.conf.xml

<param name="rtp-start-port" value="16384"/>      设置RTP port使用范围
<param name="rtp-end-port" value="32768"/>

2、freeswitch常用命令

# /usr/local/freeswitch/bin/freeswitch  启动并前台运行
# /usr/local/freeswitch/bin/freeswitch -nc  启动并后台运行
# /usr/local/freeswitch/bin/freeswitch -stop 停止

3、运行fs_cli,连接调试终端,打印服务器DEBUG信息

# /usr/local/freeswitch/bin/fs_cli -H 127.0.0.1

FreeSwitch调试终端交互如下:

freeswitch@iZuf6fya4> reloadxml  重新加载配置信息
freeswitch@iZuf6fya4> stun xxx.xxx.xxx.xxx 测试STUN服务器
freeswitch@iZuf6fya4> sofia status profile internal reg 显示在线注册用户信息
freeswitch@iZuf6fya4> sofia status profile external 查看external配置信息
freeswitch@iZuf6fya4> originate user/1000 &echo 使用originate向注册用户1000发起呼叫
freeswitch@iZuf6fya4> sofia global siptrace on 开启sip消息显示
freeswitch@iZuf6fya4> sofia global siptrace off 关闭sip消息显示
freeswitch@iZuf6fya4> /exit, /bye, /quit Ctrl+D 退出客户端

FressSwitch会议配置

freeswitch@iZuf6fya4> conference 3000 dial user/1001 呼叫账号1001加入会议3000
freeswitch@iZuf6fya4> conference 3000 vid-floor 2 force

Freeswitch使用自签证书

freeswitch使用自签证书,配置WSS_Bang的博客-CSDN博客_freeswitch wss配置

SIP相关知识内容 

SIP头域说明

Request-URI

呼叫请求发送地址。UA生成初始请求消息时,该域中的信息一般与TO中的地址相同,经过网络服务器后,由于实际路由问题,该值可能发生变化以,另外一个比较特殊的是REGISTER消息,在REGISTER消息中,在REQUEST-URI中将会填充注册服务器的地址(表示消息发往注册服务器),而此时TO域中的地址将会填充客户端实际的地址。

From

发起请求方的地址。一般采用USERINFO@HOSTPORT形式。该域同时带有一个TAG参数,是随机产生的整数。

To

接受方地址。同FROM域相同,也采用USERINFO@HOSTPORT的地址形式,当该域存在于最终响应消息中时,将会事有TAG参数。

Call-ID

用于识别呼叫参数,在同一个DIALOG中,该参数不发生变化。该参数与FROM中的TAG参数、TO域中的TAG参数相结合用以保证呼叫的惟一性。

Cseq

表征TRANSACEION的参数,由于同一个呼叫中会存在多个TRANSACTION,因此通过该能数来保证同一个USERAGENT发送的不同请求消息间的顺序。

Via

该参数表征呼叫经过的路径,UA生成SIP消息时,会在该域中填写自己的地址:PROXY在转发请求消息时,将会增加一个填有自己地址的VIA域,表示才叫经过本PROXY。VIA域的存在可以保证响应消息按照原路径返回到主叫方。代理服务器用它检查其内容,如果新端点已出现在via列表中,则表示有环路了。

Contact

告知对端自己的地址。当对端发送下一个请求消息时,可直接向该地址发送,不需要关心前一个路由信息(除非有特定原则,例如PROXY可以通过RECORD-ROUTE域来保证下一个请求消息必须经过本PROXY,即使CONTACT域中填写对端客户的地址。

Expires

limits search time,

给出消息内容超期的时间

Record-Route

由于CONTACT域的存在使得两个用户后续的请求消息可能不经过PROXY,为了运营需要,PROXY在初始INVITE消息中增加了RECORD-ROUTE域,这样可以保证后续请求(例如BYE消息)经过PROXY.通过RECORD-ROUTE与CONTACT的结合,既可避免后续请求旁路网络服务器的行为,又可减少后续请求路径上的环节。

CONTENT-TYPE

表征消息格式的参数,例如,呼叫采用了SDP进行会话描述,还是采用其他类型的会话描述协议。

SIP Status Mapping

Q.850 Cause Value NumberQ.850 Cause Value NumberSIP Status NumberSIP Status TextComments
1Unallocated number404Not foundN/A
2No route to specified transit network404Not foundN/A
3No route destination404Not foundN/A
16Normal calling clearingN/ABYE messageA call clearing BYE message containing cause value 16 normally results in the sending of a SIP BYE or CANCEL request. However, if a SIP response is to be sent to the INVITE request, the default response code should be used.
17User busy486Busy hereN/A
18No user responding408Request timeoutN/A
19No answer from the user480Temporarily unavailableN/A
20Subscriber absent480Temporarily unavailableN/A
21Call rejected603Decline (if location filed in Cause information element indicates user; otherwise 403 Forbidden is used)N/A
22Number changed301Moved permanently (if information in diagnostic field of Cause information element is suitable for generating SIP Contact header; otherwise 410 Gone is used)N/A
23Redirection to new destination410GoneN/A
25Exchange routing error483Too many hopsN/A
27Destination out of order502Bad gatewayN/A
28Address incomplete484Address incompleteN/A
29Facility rejected501Not implementedN/A
31Normal, unspecified480Temporarily unavailableN/A
34No circuit, channel unavailable503Service unavailableN/A
38Network out of order503Service unavailableN/A
41Temporary failure503Service unavailableN/A
42Switching equipment congestion503Service unavailableN/A
47Resource unavailable unspecified503Service unavailableN/A
55Incoming calls barred with CUG403ForbiddenN/A
57Bearer capability not authorized403ForbiddenN/A
58Bearer capability not presently available503Service unavailableN/A
65Bearer capability not implemented488Not acceptable hereN/A
69Requested facility not implemented501Not implementedN/A
70Only restricted digital information available488Not acceptable hereN/A
79Service or option not implemented, unspecified501Not implementedN/A
87User not member of CUG403ForbiddenN/A
88Incompatible destination503Service unavailableN/A
102Recovery on timer expiry504Server time-outN/A
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值