技术分享|Sip与WebRTC互通-SRProxy开源库讲解
<h1 style="color: black; text-align: left; margin-bottom: 10px;">SRProxy 介绍</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">日前</span> WebRTC 协议跟 SIP 协议互通场景<span style="color: black;">重点</span>运用在企业呼叫中心、企业内部通信、<span style="color: black;">tel</span>会议(PSTN)、智能门禁等场景,<span style="color: black;">想要</span>让 WebRTC 与 SIP 互通,要<span style="color: black;">处理</span>两个层面的问题:</span><strong style="color: blue;"><span style="color: black;">信令层</span></strong><span style="color: black;">和</span><strong style="color: blue;"><span style="color: black;"><span style="color: black;">媒介</span>层</span></strong><span style="color: black;">。两个网络<span style="color: black;">运用</span>的信令机制<span style="color: black;">区别</span>,<span style="color: black;">因此</span>要进行信令的转换,<span style="color: black;">才可</span>完成<span style="color: black;">媒介</span>的协商,<span style="color: black;">创立</span>会话;<span style="color: black;">媒介</span>层要完成编码的转换,以及 rtp/srtp 转换等功能。anyRTC 开源 SRProxy 网关,<span style="color: black;">处理</span>了 WebRTC 与 SIP 的协议转换,<span style="color: black;">协同</span> anyRTC 开源的 ARCall 音视频呼叫 demo,演示<span style="color: black;">怎样</span><span style="color: black;">经过</span> App/Web 端呼叫落地,下文就<span style="color: black;">怎样</span><span style="color: black;">运用</span><span style="color: black;">安排</span> SRProxy 网关,以及<span style="color: black;">怎样</span>跟 ARCall 互通进行展开,<span style="color: black;">熟练</span><span style="color: black;">怎样</span><span style="color: black;">运用</span>后,可集成 SDK 到自己的应用中,<span style="color: black;">协同</span><span style="color: black;">自己</span>业务做对应的场景。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">呼叫流程</h1>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">1、</span>ARCall 呼叫<span style="color: black;">规律</span></h1>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/a33c6bedba5a49e4bcc5d08f2b95bcfb~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=iT%2FnWvwriHOceG%2Fl4QzwCu35HjU%3D" style="width: 50%; margin-bottom: 20px;"></div>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/521d6dd871cf4472a9fb072d736fac54~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=wRRu4sf9EBnJ6nOR1vIl1Gntm%2Bc%3D" style="width: 50%; margin-bottom: 20px;"></div>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">2、</span>SRProxy 转发<span style="color: black;">规律</span></h1>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">1、SRProxy 能做什么?</h1>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/991f127539514822b621616f19907115~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=U8JrF9SeDAQ%2FbH3trU4rLnr3%2FR0%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">从上图简单概括一下:SRProxy 是实现 RTC 和 SIP 之间业务互通的桥梁,<span style="color: black;">更加是</span>实现业务拓展的关键服务。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">2、ARCall 呼叫流程</h1>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">1、状态流转图</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">呼叫邀请中,主叫<span style="color: black;">能够</span><span style="color: black;">经过</span> 对象<span style="color: black;">供给</span>的 <span style="color: black;">办法</span><span style="color: black;">查找</span>当前呼叫邀请的<span style="color: black;">相关</span>状态;被叫<span style="color: black;">能够</span><span style="color: black;">经过</span> SDK 返回的 对象的 <span style="color: black;">办法</span><span style="color: black;">查找</span>当前呼叫邀请的<span style="color: black;">关联</span>状态。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">LocalInvitationState</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">下图描述了与主叫<span style="color: black;">关联</span>的呼叫邀请状态流转图:</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/eeb020f414f141b7b42b20f811bc0d2a~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=htrJl3E96jE3hQp4gCrMrIC6%2Brc%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">RemoteInvitationState</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">下图描述了与被叫<span style="color: black;">关联</span>的呼叫邀请状态流转图:</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p26-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/2235d14b6a3240b295e4e724a6733337~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=o7IyJD9N7fI%2Fl55H75B1ysQuUug%3D" style="width: 50%; margin-bottom: 20px;"></div>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">2、API 时序图</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">取消已发送呼叫邀请</span></strong></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/1a54626d5ffc41edb5ecb9751f47f5ca~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=rx0HURtrxwKbTwT9y%2BPVoEbUUqk%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">接受/拒绝呼叫邀请</span></strong></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/3eabbe5c169641639721feea6519e61b~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=L%2BuDB5%2FdAOCuYgOFSQdsbiJ%2BvJ8%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;"><span style="color: black;">重视</span>事项及限制<span style="color: black;">要求</span></span></strong></p><span style="color: black;">主叫设置的呼叫邀请 content 的字符串长度:8 KB,格式为 UTF-8。</span><span style="color: black;">被叫设置的呼叫邀请响应 response 的字符串长度:8 KB,格式为 UTF-8。</span><span style="color: black;">呼叫邀请的 channelId 仅用于与信令互通时设置。设置的 channelId 必须与信令 SDK 设置相同<span style="color: black;">才可</span>实现互通。字符串长度:64 字节,格式为 UTF-8。</span>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">创建一个应用</h1>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">1、</span>注册账号</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">到 anyRTC官网 注册一个<span style="color: black;">研发</span>者账号,并创建一个应用</p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/f183f78b20144b25afcd7965ee4d80d7~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=%2Ftrh1pk%2FHbuV7sgnSzGG7y20%2BWU%3D" style="width: 50%; margin-bottom: 20px;"></div>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">2、</span>创建应用获取 AppId</h1>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/71cd04ac5c644cdb937988a8b948ffdf~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=d%2F9PJlpHrUGHbNcvT0ybRD138EE%3D" style="width: 50%; margin-bottom: 20px;"></div>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">安排</span> freeswitch</h1>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">1、</span>准备</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">1、</span>系统</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">Centos 7.9 最好是纯净服务器 <span style="color: black;">否则</span>可能会存在依赖装不上或冲突<span style="color: black;">状况</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">2、</span>防火墙</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">参考freeswitch防火墙: </p>https://freeswitch.org/confluence/display/FREESWITCH/Firewall<span style="color: black;"># 开放sip端口tcp协议</span>
<span style="color: black;"># firewall-cmd --permanent --add-port=5060/tcp</span>
<span style="color: black;"># 开放sip端口udp协议</span>
<span style="color: black;"># firewall-cmd --permanent --add-port=5060/udp</span>
<span style="color: black;"># 开放ws端口</span>
<span style="color: black;"># firewall-cmd --permanent --add-port=5066/tcp</span>
<span style="color: black;"># 开放wss端口</span>
<span style="color: black;"># firewall-cmd --permanent --add-port=7443/tcp</span>
<span style="color: black;"># 开放rtp端口(范围)</span>
<span style="color: black;"># firewall-cmd --permanent --add-port=16384-32768/udp</span>
<span style="color: black;"># 让防火墙配置生效</span><span style="color: black;"># firewall-cmd --reload</span>
<span style="color: black;"># <span style="color: black;">亦</span><span style="color: black;">能够</span>直接关闭防火墙</span>
<span style="color: black;"># systemctl stop firewalld</span>
<span style="color: black;"># systemctl disable firewalld</span>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">2、</span>编译环境和FreeSwitch依赖库</h1><span style="color: black;"># 更新yum源</span>
<span style="color: black;"># yum update -y</span>
<span style="color: black;"># 安装lib<span style="color: black;">关联</span><span style="color: black;">需要</span>依赖</span>
<span style="color: black;"># yum install -y yum-utils git gcc gcc-c++ automake autoconf libtool libtiff-devel libjpeg-devel openssl-devel vim</span>
<span style="color: black;"># 添加环境变量</span>
<span style="color: black;"># vim /etc/profile</span>
export PKG_CONFIG_PATH=<span style="color: black;">/usr/local</span><span style="color: black;">/lib/p<span style="color: black;">公斤</span>config</span>
<span style="color: black;"># source /etc/profile</span>
<span style="color: black;"># 单独下载spandsp源码</span>
<span style="color: black;"># cd /usr/local/src</span>
<span style="color: black;"># git clone https://github.com/freeswitch/spandsp.git</span><span style="color: black;"># cd spandsp</span>
<span style="color: black;"># ./bootstrap.sh</span>
<span style="color: black;"># ./configure</span>
<span style="color: black;"># make</span><span style="color: black;"># make install</span>
<span style="color: black;"># ldconfig</span>
<span style="color: black;"># 单独下载sofia-sip(SIP协议栈)源码 尝试<span style="color: black;">运用</span>过码云上面的,<span style="color: black;">然则</span>freeswitch编译的时候<span style="color: black;">始终</span>报错需要sofia-sip</span>
<span style="color: black;"># cd /usr/local/src</span>
<span style="color: black;"># git clone https://github.com/freeswitch/sofia-sip.git</span>
<span style="color: black;"># cd sofia-sip</span>
<span style="color: black;"># ./bootstrap.sh -j</span>
<span style="color: black;"># ./configure</span>
<span style="color: black;"># make</span>
<span style="color: black;"># make install</span>
<span style="color: black;"># ldconfig</span>
<span style="color: black;"># 单独下载libuuid源码</span>
<span style="color: black;"># cd /usr/local/src</span>
<span style="color: black;"># wget https://jaist.dl.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz</span>
<span style="color: black;"># tar -zxvf libuuid-1.0.3.tar.gz</span>
<span style="color: black;"># cd libuuid-1.0.3</span>
<span style="color: black;"># ./configure</span><span style="color: black;"># make</span>
<span style="color: black;"># make install</span>
<span style="color: black;"># 编译安装cmake 3.8.2</span>
<span style="color: black;"># cd /usr/local/src</span>
<span style="color: black;"># wget https://cmake.org/files/v3.8/cmake-3.8.2.tar.gz</span>
<span style="color: black;"># tar zxvf cmake-3.8.2.tar.gz</span>
<span style="color: black;"># cd cmake-3.8.2</span><span style="color: black;"># ./bootstrap</span>
<span style="color: black;"># gmake</span>
<span style="color: black;"># gmake install</span>
<span style="color: black;"># 安装libatomic</span>
<span style="color: black;"># yum install -y libatomic</span>
<span style="color: black;"># 单独下载libks源码(需要cmake 3.7.2以上版本)</span>
<span style="color: black;"># cd /usr/local/src</span>
<span style="color: black;"># git clone https://github.com/signalwire/libks.git</span><span style="color: black;"># cmake .</span>
<span style="color: black;">## <span style="color: black;">倘若</span><span style="color: black;">显现</span>uuid错误,就重新编译libuuid源码,还是uuid错误就退出终端重新进入在执行cmake .</span>
<span style="color: black;"># make</span>
<span style="color: black;"># make install</span>
<span style="color: black;"># 安装fs依赖</span>
<span style="color: black;"># yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release</span>
<span style="color: black;"># 安装ffmpeg需要</span>
<span style="color: black;"># rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro</span>
<span style="color: black;"># rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm</span>
<span style="color: black;"># yum安装<span style="color: black;">关联</span>依赖</span>
<span style="color: black;"># yum install -y alsa-lib-devel bison broadvoice-devel bzip2 curl-devel libdb4-devel e2fsprogs-devel erlang flite-devel g722_1-devel gdbm-devel gnutls-devel ilbc2-devel ldns-devel libcodec2-devel libcurl-devel libedit-devel libidn-devel libmemcached-devel libogg-devel libsilk-devel libsndfile-devel libtheora-devel libuuid-devel libvorbis-devel libxml2-devel lua-devel lzo-devel ncurses-devel net-snmp-devel opus-devel pcre-devel perl perl-ExtUtils-Embed p<span style="color: black;">公斤</span>config portaudio-devel postgresql-devel python-devel python-devel soundtouch-devel speex-devel sqlite-devel unbound-devel unixODBC-devel which yasm zlib-devel libshout-devel libmpg123-devel lame-devel rpm-build libX11-devel libyuv-devel swig wget ffmpeg ffmpeg-devel</span>
<span style="color: black;"># 安装python组件</span>
<span style="color: black;"># curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip-2.7.py</span><span style="color: black;"># python get-pip-2.7.py</span>
<span style="color: black;"># 验证pip<span style="color: black;">是不是</span>安装成功</span>
<span style="color: black;"># pip --version</span>
<span style="color: black;"># pip安装python组件</span>
<span style="color: black;"># pip install pydub python-ESL pika dbutils</span>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">三、安装FreeSwitch</h1><span style="color: black;"># git下载freeswitch</span>
<span style="color: black;"># git clone -b v1.10 https://github.com/signalwire/freeswitch.git freeswitch</span>
<span style="color: black;"># <span style="color: black;">倘若</span>github连接不顺畅的话,<span style="color: black;">能够</span>试试码云镜像仓库(更新慢1天)</span>
<span style="color: black;"># git clone -b v1.10 https://gitee.com/mirrors/FreeSWITCH.git freeswitch</span>
<span style="color: black;"># 编译安装freeswitch前奏</span>
<span style="color: black;"># cd freeswitch</span>
<span style="color: black;"># ./bootstrap.sh -j</span>
<span style="color: black;"># vim modules.conf</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">按照</span>需要打开或关闭注释</span></span></p><span style="color: black;">formats</span>/mod_shout
<span style="color: black;">languages</span>/mod_python
<span style="color: black;">#event_handlers/mod_cdr_pg_csv</span>
<span style="color: black;">asr_tts</span>/mod_unimrcp
<span style="color: black;">endpoints</span>/mod_rtmp<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">倘若</span>需要<span style="color: black;">运用</span>mod_xml_curl的话</span></span></p>xml_int/mod_xml_curl<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">给不需要的模块加上注释</span></span></p><span style="color: black;">#applications/mod_av</span>
<span style="color: black;">#applications/mod_signalwire</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">编译安装</span></span></p><span style="color: black;"># ./configure --with-python=/usr/bin/python2.7 --with-lua=/usr/bin/lua --enable-core-pgsql-support</span>
<span style="color: black;"># <span style="color: black;">倘若</span>在spandsp位置报错,<span style="color: black;">能够</span>尝试执行下面这句 在执行./configure</span>
<span style="color: black;"># export PKG_CONFIG_PATH=/usr/local/lib/p<span style="color: black;">公斤</span>config</span>
<span style="color: black;"># 编译freeswitch</span>
<span style="color: black;"># make</span>
<span style="color: black;"># 编译安装 mod_cdr_pg_csv-install</span>
<span style="color: black;"># make mod_unimrcp-install</span>
<span style="color: black;"># <span style="color: black;">倘若</span>需要空上模块的话</span>
<span style="color: black;"># make mod_xml_curl-install</span>
<span style="color: black;"># 编译安装音频文件(英文)</span>
<span style="color: black;"># make cd-sounds-install</span>
<span style="color: black;"># make cd-moh-install</span>
<span style="color: black;"># 编译安装freeswitch</span><span style="color: black;"># make install</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">额外安装音频文件(英文)</span></span></p><span style="color: black;"># make uhd-sounds-install</span>
<span style="color: black;"># make uhd-moh-install</span><span style="color: black;"># make hd-sounds-install</span>
<span style="color: black;"># make hd-moh-install</span>
<span style="color: black;"># make sounds-install</span><span style="color: black;"># make moh-install</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">创立</span>软连接</span></span></p><span style="color: black;"># sudo ln -sf /usr/local/freeswitch/bin/freeswitch /usr/local/bin/</span>
<span style="color: black;"># sudo ln -sf /usr/local/freeswitch/bin/fs_cli /usr/local/bin/</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">配置mod</span></span></p><span style="color: black;"># vim /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">在前3行开启(位置可能不对,能找到)</span></span></p> <load <span style="color: black;">module</span>=<span style="color: black;">"mod_console"</span>/>
<load <span style="color: black;">module</span>=<span style="color: black;">"mod_logfile"</span>/>
<load <span style="color: black;">module</span>=<span style="color: black;">"mod_xml_curl"</span>/><p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">打开注释</span></span></p> <load <span style="color: black;">module</span>=<span style="color: black;">"mod_python"</span>/>
<load <span style="color: black;">module</span>=<span style="color: black;">"mod_shout"</span>/><p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">添加配置</span></span></p> <span style="color: black;"><<span style="color: black;">load</span> <span style="color: black;">module</span>=<span style="color: black;">"mod_cdr_pg_csv"</span>/></span>
<span style="color: black;"><<span style="color: black;">load</span> <span style="color: black;">module</span>=<span style="color: black;">"mod_unimrcp"</span>/></span>
<span style="color: black;"><!--<load module="mod_vad"/>--></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">注释掉其他不需要的模块</span></span></p> <span style="color: black;"><!-- <load module="mod_av"/> --></span>
<span style="color: black;"><!-- <load module="mod_signalwire"/> --></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">倘若</span><span style="color: black;">无</span>其它<span style="color: black;">需求</span> </span><span style="color: black;"><span style="color: black;"><span style="color: black;">安排</span>freeswitch</span></span><span style="color: black;">到这就<span style="color: black;">能够</span>结束了</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">配置acl白名单</span></span></p><span style="color: black;"># vim /usr/local/freeswitch/conf/autoload_configs/acl.conf.xml</span><span style="color: black;"><!-- <span style="color: black;">按照</span>自己网络的<span style="color: black;">实质</span><span style="color: black;">状况</span>进行配置(照抄大概率无效) --></span>
<span style="color: black;"><<span style="color: black;">list</span> <span style="color: black;">name</span>=<span style="color: black;">"domains"</span> <span style="color: black;">default</span>=<span style="color: black;">"deny"</span>></span>
<span style="color: black;"><!-- domain= is special it scans the domain from the directory to build t$ --></span>
<span style="color: black;"><<span style="color: black;">node</span> <span style="color: black;">type</span>=<span style="color: black;">"allow"</span> <span style="color: black;">domain</span>=<span style="color: black;">"$${domain}"</span>/></span>
<span style="color: black;"><!-- ==================<span style="color: black;">这儿</span>添加 本机ip 127.0.0.1 ======================== --></span>
<span style="color: black;"><!-- ==================<span style="color: black;">这儿</span>添加 本机内网ip ======================== --></span>
<span style="color: black;"><!-- ==================<span style="color: black;">这儿</span>添加 本机外网ip ======================== --></span>
<span style="color: black;"><!-- ==================<span style="color: black;">这儿</span>添加 web内网ip 192.168.1.221======================== --></span>
<span style="color: black;"><!-- ==================<span style="color: black;">这儿</span>添加 web外网ip 公网IP======================== --></span>
<span style="color: black;"><!-- ==================<span style="color: black;">这儿</span>添加 runcall 内外网Ip======================== --></span>
<span style="color: black;"><<span style="color: black;">node</span> <span style="color: black;">type</span>=<span style="color: black;">"allow"</span> <span style="color: black;">cidr</span>=<span style="color: black;">"192.168.1.0/24"</span>/></span>
<span style="color: black;"><<span style="color: black;">node</span> <span style="color: black;">type</span>=<span style="color: black;">"allow"</span> <span style="color: black;">cidr</span>=<span style="color: black;">"公网IP/32"</span>/></span>
<span style="color: black;"></<span style="color: black;">list</span>></span><span style="color: black;"># <span style="color: black;">保留</span>后,在freeswitch客户端,输入reloadacl reloadxml进行重新加载acl文件</span><span style="color: black;"># fs_cli</span>
freeswitch@localhost>reloadacl reloadxml<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">配置ESL</span></span></p><span style="color: black;"># vim /usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml</span><span style="color: black;"><<span style="color: black;">configuration</span> <span style="color: black;">name</span>=<span style="color: black;">"event_socket.conf"</span> <span style="color: black;">description</span>=<span style="color: black;">"Socket Client"</span>></span>
<span style="color: black;"><<span style="color: black;">settings</span>></span>
<span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"nat-map"</span> <span style="color: black;">value</span>=<span style="color: black;">"false"</span>/></span>
<span style="color: black;"><!--ip 统一为0.0.0.0--></span>
<span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"listen-ip"</span> <span style="color: black;">value</span>=<span style="color: black;">"0.0.0.0"</span>/></span>
<span style="color: black;"><!-- 端口号 默认8021 --></span>
<span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"listen-port"</span> <span style="color: black;">value</span>=<span style="color: black;">"8021"</span>/></span>
<span style="color: black;"><!-- <span style="color: black;">秘码</span>统一Aicyber --></span>
<span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"password"</span> <span style="color: black;">value</span>=<span style="color: black;">"Aicyber"</span>/></span>
<span style="color: black;"><!-- <span style="color: black;">准许</span>acl白名单内的IP 访问 --></span>
<span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"apply-inbound-acl"</span> <span style="color: black;">value</span>=<span style="color: black;">"domains"</span>/></span>
<span style="color: black;"><!--<param name="apply-inbound-acl" value="loopback.auto"/>--></span>
<span style="color: black;"><!--<param name="stop-on-bind-error" value="true"/>--></span>
<span style="color: black;"></<span style="color: black;">settings</span>></span>
<span style="color: black;"></<span style="color: black;">configuration</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">适配WebRTC(JSSIP/SIPJS)</span></span></p><span style="color: black;"># vim /usr/local/freeswitch/conf/sip_profiles/internal.xml</span> <span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"apply-candidate-acl"</span> <span style="color: black;">value</span>=<span style="color: black;">"rfc1918.auto"</span>/></span>
<span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"apply-candidate-acl"</span> <span style="color: black;">value</span>=<span style="color: black;">"localnet.auto"</span>/></span>
<span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"apply-candidate-acl"</span> <span style="color: black;">value</span>=<span style="color: black;">"candidate"</span>/></span>
<span style="color: black;"><!-- 取消注释这一行(让前端<span style="color: black;">能够</span>得到<span style="color: black;">初期</span><span style="color: black;">媒介</span>) --></span>
<span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"enable-100rel"</span> <span style="color: black;">value</span>=<span style="color: black;">"true"</span>/></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">拨号计划</span></span></p><span style="color: black;"># vim /usr/local/freeswitch/conf/sip_profiles/internal.xml</span> <span style="color: black;"><!-- 默认是public --></span>
<span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"context"</span> <span style="color: black;">value</span>=<span style="color: black;">"default"</span>/></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">关闭ipv6</span></span></p>[<span style="color: black;">root@</span>localhost ~]# cd /usr/local/freeswitch/conf/sip_profiles
[<span style="color: black;">root@</span>localhost sip_profiles]# mv<span style="color: black;">internal</span>-ipv6.xml <span style="color: black;">internal</span>-ipv6.xml.removed
[<span style="color: black;">root@</span>localhost sip_profiles]# mv <span style="color: black;">external</span>-ipv6.xml <span style="color: black;">external</span>-ipv6.xml.removed<h1 style="color: black; text-align: left; margin-bottom: 10px;">四:配置Sip的Proxy转发规则</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"># vim </p>/usr/local/freeswitch/conf/dialplan/default.xml ##配置文件中加入以下配置,多个SRProxy 就配置多个号码
<span style="color: black;"><<span style="color: black;">extension</span> <span style="color: black;">name</span>=<span style="color: black;">"group_dial_sip_proxy"</span>></span>
<span style="color: black;"><<span style="color: black;">condition</span> <span style="color: black;">field</span>=<span style="color: black;">"destination_number"</span> <span style="color: black;">expression</span>=<span style="color: black;">"^0(.*)$"</span>></span>
<span style="color: black;"><<span style="color: black;">action</span> <span style="color: black;">application</span>=<span style="color: black;">"set"</span>></span><!]><span style="color: black;"></<span style="color: black;">action</span>></span>
<span style="color: black;"><<span style="color: black;">action</span> <span style="color: black;">application</span>=<span style="color: black;">"bridge"</span> <span style="color: black;">data</span>=<span style="color: black;">"user/1000@192.168.x.xx"</span>/></span>
<span style="color: black;"></<span style="color: black;">condition</span>></span>
<span style="color: black;"></<span style="color: black;">extension</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">意思是:<span style="color: black;">倘若</span>呼叫的SIP号码前面加0,则自动路由到1000号码上;这个1000号码是SRProxy中配置的Proxy账号,<span style="color: black;">这般</span>SRProxy就<span style="color: black;">能够</span>收到Sip外呼的请求,从发对RTC发起呼叫。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">注:配置中192.168.x.xx是你<span style="color: black;">设备</span>的真实IP,有公网EIP填公网EIP<span style="color: black;">位置</span>,局域网则填局域网IP<span style="color: black;">位置</span>。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">5、</span>FreeSwitch呼叫时间修改</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">安装完freeswitch<span style="color: black;">发掘</span>进行sip呼叫的时候<span style="color: black;">显现</span>差不多延时10秒<span style="color: black;">上下</span><span style="color: black;">才可</span>接收呼叫 <span style="color: black;">重点</span><span style="color: black;">原由</span>是freeswitch中默认配置了延时时间 只需要注释掉就能<span style="color: black;">处理</span>这个问题</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># vim /usr/local/freeswitch/conf/dialplan/default.xml</span></p> <span style="color: black;"><<span style="color: black;">condition</span> <span style="color: black;">field</span>=<span style="color: black;">"${default_password}"</span> <span style="color: black;">expression</span>=<span style="color: black;">"^1234$"</span> <span style="color: black;">break</span>=<span style="color: black;">"never"</span>></span>
<span style="color: black;"><<span style="color: black;">action</span> <span style="color: black;">application</span>=<span style="color: black;">"log"</span> <span style="color: black;">data</span>=<span style="color: black;">"CRIT WARNING WARNING WARNING WARNING WARNING WARNING WARNI NG WARNING WARNING "</span>/></span>
<span style="color: black;"><<span style="color: black;">action</span> <span style="color: black;">application</span>=<span style="color: black;">"log"</span> <span style="color: black;">data</span>=<span style="color: black;">"CRIT Open $${conf_dir}/vars.xml and change the default_pas sword."</span>/></span>
<span style="color: black;"><<span style="color: black;">action</span> <span style="color: black;">application</span>=<span style="color: black;">"log"</span> <span style="color: black;">data</span>=<span style="color: black;">"CRIT Once changed type reloadxml at the console."</span>/></span>
<span style="color: black;"><<span style="color: black;">action</span> <span style="color: black;">application</span>=<span style="color: black;">"log"</span> <span style="color: black;">data</span>=<span style="color: black;">"CRIT WARNING WARNING WARNING WARNING WARNING WARNING WARNI NG WARNING WARNING "</span>/></span>
<span style="color: black;"><!--<action application="sleep" data="10000"/>--></span> #注释这一行<span style="color: black;">就可</span>
<span style="color: black;"></<span style="color: black;">condition</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">起步</span>生效</span></span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">6、</span>FreeSwitch<span style="color: black;">表示</span>主叫号码</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># cd /usr/local/freeswitch/conf/directory/default # vim 1000.xml</span></p><span style="color: black;"><<span style="color: black;">include</span>></span>
<span style="color: black;"><<span style="color: black;">user</span> <span style="color: black;">id</span>=<span style="color: black;">"1000"</span>></span>
<span style="color: black;"><<span style="color: black;">params</span>></span>
<span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"password"</span> <span style="color: black;">value</span>=<span style="color: black;">"$${default_password}"</span>/></span>
<span style="color: black;"><<span style="color: black;">param</span> <span style="color: black;">name</span>=<span style="color: black;">"vm-password"</span> <span style="color: black;">value</span>=<span style="color: black;">"1000"</span>/></span>
<span style="color: black;"></<span style="color: black;">params</span>></span>
<span style="color: black;"><<span style="color: black;">variables</span>></span>
<span style="color: black;"><<span style="color: black;">variable</span> <span style="color: black;">name</span>=<span style="color: black;">"toll_allow"</span> <span style="color: black;">value</span>=<span style="color: black;">"domestic,international,local"</span>/></span>
<span style="color: black;"><<span style="color: black;">variable</span> <span style="color: black;">name</span>=<span style="color: black;">"accountcode"</span> <span style="color: black;">value</span>=<span style="color: black;">"1000"</span>/></span>
<span style="color: black;"><<span style="color: black;">variable</span> <span style="color: black;">name</span>=<span style="color: black;">"user_context"</span> <span style="color: black;">value</span>=<span style="color: black;">"default"</span>/></span>
<span style="color: black;"><!--<variable name="effective_caller_id_name" value="Extension 1000"/>--></span> # 注释
<span style="color: black;"><!--<variable name="effective_caller_id_number" value="1000"/>--></span> # 注释这两行
<span style="color: black;"><<span style="color: black;">variable</span> <span style="color: black;">name</span>=<span style="color: black;">"outbound_caller_id_name"</span> <span style="color: black;">value</span>=<span style="color: black;">"$${outbound_caller_name}"</span>/></span>
<span style="color: black;"><<span style="color: black;">variable</span> <span style="color: black;">name</span>=<span style="color: black;">"outbound_caller_id_number"</span> <span style="color: black;">value</span>=<span style="color: black;">"$${outbound_caller_id}"</span>/></span>
<span style="color: black;"><<span style="color: black;">variable</span> <span style="color: black;">name</span>=<span style="color: black;">"callgroup"</span> <span style="color: black;">value</span>=<span style="color: black;">"techsupport"</span>/></span>
<span style="color: black;"></<span style="color: black;">variables</span>></span>
<span style="color: black;"></<span style="color: black;">user</span>></span>
<span style="color: black;"></<span style="color: black;">include</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">起步</span>生效</span></span></p><span style="color: black;">## 后台快速<span style="color: black;">起步</span></span>
<span style="color: black;"># freeswitch -nc -nonat</span>
<span style="color: black;">## <span style="color: black;">掌控</span>台<span style="color: black;">起步</span>(退出即关闭服务)</span>
<span style="color: black;"># freeswitch</span>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">7、</span>FreeSwitch自动<span style="color: black;">增多</span>号码</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">freeswitch是一个开源的呼叫中心服务,默认号码是1000-1019 <span style="color: black;">仅有</span>20个号码时,<span style="color: black;">没法</span>满足时,需要<span style="color: black;">增多</span>号码<span style="color: black;">运用</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># vim /usr/local/freeswitch/conf/dialplan/default.xml</span></p> <span style="color: black;"><<span style="color: black;">extension</span> <span style="color: black;">name</span>=<span style="color: black;">"Local_Extension"</span>></span>
<span style="color: black;"><!--<condition field="destination_number" expression="^(10)$">--></span># 注释这一行 <span style="color: black;">或</span>修改这一行<span style="color: black;"><<span style="color: black;">condition</span> <span style="color: black;">field</span>=<span style="color: black;">"destination_number"</span> <span style="color: black;">expression</span>=<span style="color: black;">"^(1|20)$"</span>></span> # 重新定义号码段 段为1000~2099
<span style="color: black;"><<span style="color: black;">action</span> <span style="color: black;">application</span>=<span style="color: black;">"export"</span> <span style="color: black;">data</span>=<span style="color: black;">"dialed_extension=$1"</span>/></span>
<span style="color: black;"><!-- bind_meta_app can have these args <key> <app> --></span>
<span style="color: black;"><<span style="color: black;">action</span> <span style="color: black;">application</span>=<span style="color: black;">"bind_meta_app"</span> <span style="color: black;">data</span>=<span style="color: black;">"1 b s execute_extension::dx XML features"</span>/></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># freeswitch.sh</span></p><span style="color: black;">#!/bin/bash</span>
<span style="color: black;"># Author: lzy</span>
<span style="color: black;"># data: 2021-11-16</span>
<span style="color: black;"># 设置变量</span>
<span style="color: black;"># freeswitch存放号码目录</span>TARGET_FREESWITCH_PREFIX=/usr/<span style="color: black;">local</span>/freeswitch/conf/directory/default/
<span style="color: black;"># <span style="color: black;">由于</span>默认<span style="color: black;">已然</span>有1000-1019 <span style="color: black;">因此</span>设置从1020<span style="color: black;">起始</span>,<span style="color: black;">能够</span>随时改</span>
i=1020
<span style="color: black;"># 设置循环,-le <span style="color: black;">少于</span>等于2099结束</span>
<span style="color: black;">while</span> [ <span style="color: black;">$i</span> -le 2599 ]
<span style="color: black;">do</span>
<span style="color: black;"># i=$i+1 $i=1020 逐步往上+1</span>
<span style="color: black;">let</span> i=<span style="color: black;">$i</span>+1
<span style="color: black;"># cp 复制1000.xml 重命名$i 逐步+1</span>
cp <span style="color: black;">$TARGET_FREESWITCH_PREFIX</span>/1000.xml <span style="color: black;">$TARGET_FREESWITCH_PREFIX</span>/<span style="color: black;">$i</span>.xml
<span style="color: black;"># sed将1000.xml文件里面的1000 改为文件本身的数值</span>
sed -i <span style="color: black;">"s/1000/<span style="color: black;">$i</span>/"</span> <span style="color: black;">$TARGET_FREESWITCH_PREFIX</span>/<span style="color: black;">$i</span>.xml
<span style="color: black;">done</span><span style="color: black;">## 脚本授权 执行脚本</span>
<span style="color: black;"># chmod +x freeswitch.sh</span>
<span style="color: black;"># ./freeswitch.sh</span>
<span style="color: black;">## <span style="color: black;">保留</span>后,在freeswitch客户端,输入reloadxml进行重新加载.xml文件</span>
<span style="color: black;"># fs_cli</span>
freeswitch@localhost>reloadxml<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">安排</span>SRProxy</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">源码<span style="color: black;">位置</span>:</p>https://github.com/anyRTC-UseCase/SipRtcProxy
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">1、</span>Windows 7 +</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">双击:SipRtcProxy.sln ,直接运行</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">项目是VS2017创建,VS2015,VS2019可<span style="color: black;">自动</span>验证。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">2、</span>Linux - Centos7.0 +</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">下载代码到本地</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># git clone https://github.com/anyRTC-UseCase/SipRtcProxy.git</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># cd SipRtcProxy.git</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">环境变量</span></span></p><span style="color: black;"># vim /etc/profile</span>
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH<span style="color: black;">:/root/SipRtcProxy/so/</span>
<span style="color: black;"># source /etc/profile</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">执行</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># make</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">配置文件</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># vim rtx.conf</span></p><span style="color: black;"></span>
<span style="color: black;">appid</span>=XXXXX <span style="color: black;">## 创建应用时注册的Appid </span>
<span style="color: black;">sip_svr</span>=IP:<span style="color: black;">5060</span> <span style="color: black;">## freeswitch_IP<span style="color: black;">位置</span>和端口,<span style="color: black;">日前</span>仅支持freeswitch默认端口</span>
<span style="color: black;">## 配置私有云RTC环境 注释默认连接公网环境</span>
<span style="color: black;">#</span>
<span style="color: black;">#ip=RTC_IP</span>
<span style="color: black;">#port=6080</span>
<span style="color: black;">## 配置私有云RTM环境 注释默认连接公网环境</span>
<span style="color: black;">#</span>
<span style="color: black;">#ip=RTM_IP</span>
<span style="color: black;">#port=7080</span>
<span style="color: black;">
</span>
<span style="color: black;">on</span>=<span style="color: black;">1</span> <span style="color: black;">## <span style="color: black;">是不是</span>开启RTM2SIP;0:不开启 1:开启</span>
<span style="color: black;">acc_rule</span>=<span style="color: black;">1005</span><span style="color: black;">;10 ## 号码范围<span style="color: black;">按照</span>freeswitch进行<span style="color: black;">调节</span>;号码<span style="color: black;">状况</span>:1005,1006-1019 共15个号码,同Appid下多个SRProxy 号码<span style="color: black;">不可</span>冲突</span>
<span style="color: black;">
</span>
<span style="color: black;">on</span>=<span style="color: black;">1</span> <span style="color: black;">## <span style="color: black;">是不是</span>开启SIP代理;0:不开启 1:开启</span>
<span style="color: black;">sip_account</span>=<span style="color: black;">1000</span> <span style="color: black;">## freeswitch代理账号:1000,客户端不可与此号码冲突;且一个SRProxy只能用一个号码,换个环境需换个号码,如:1001</span>
<span style="color: black;">sip_pwd</span>=<span style="color: black;">1234</span> <span style="color: black;">## freeswitch<span style="color: black;">秘码</span></span>
<span style="color: black;">rtm_account</span>=<span style="color: black;">1086</span> <span style="color: black;">## 登入RTM账号,客户端不可与此号码冲突,且一个appid只能用一个号码,换个环境需换个号码,如:1087</span>
<span style="color: black;">
</span>
<span style="color: black;">#* 0:SENSITIVE 1:VERBOSE 2:INFO 3:WARNING 4:ERROR 5:NONE</span>
<span style="color: black;">level</span>=<span style="color: black;">2</span>
<span style="color: black;">file</span>=rtc_sip.log
<span style="color: black;">max_file_size</span>=<span style="color: black;">100</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">前台<span style="color: black;">起步</span></span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># ./SRProxy rtx.conf</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">3、</span>Linux - Centos7.0 + 已编译</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">下载<span style="color: black;">位置</span>: </p>https://pan.baidu.com/s/1QhhIsO3NEf9olX19xVxBKg
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">提取码:l1f2</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">创建目录</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># mkdir /usr/local/ar4/</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># tar zxvf SRProxy.tar.gz</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">将srproxy.tar.gz放到/usr/local/ar4/解压</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># cd /usr/local/ar4/</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># tar zxvf srproxy.tar.gz</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">将rtx.sh脚本放入/usr/bin下面并赋予权限</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># chmod +x /usr/bin/rtx.sh</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">进入目录</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># cd /usr/local/ar4/srproxy/ # vim conf/rtx.conf</span></p><span style="color: black;"></span>
<span style="color: black;">appid</span>=XXXXX <span style="color: black;">## 创建应用时注册的Appid </span>
<span style="color: black;">sip_svr</span>=IP:<span style="color: black;">5060</span> <span style="color: black;">## freeswitch_IP<span style="color: black;">位置</span>和端口,<span style="color: black;">日前</span>仅支持freeswitch默认端口</span>
<span style="color: black;">## 配置私有云RTC环境 注释默认连接公网环境</span>
<span style="color: black;">#</span>
<span style="color: black;">#ip=RTC_IP</span>
<span style="color: black;">#port=6080</span>
<span style="color: black;">## 配置私有云RTM环境 注释默认连接公网环境</span>
<span style="color: black;">#</span>
<span style="color: black;">#ip=RTM_IP</span>
<span style="color: black;">#port=7080</span>
<span style="color: black;">
</span>
<span style="color: black;">on</span>=<span style="color: black;">1</span> <span style="color: black;">## 是否开启RTM2SIP;0:不开启 1:开启</span>
<span style="color: black;">acc_rule</span>=<span style="color: black;">1005</span><span style="color: black;">;10 ## 号码范围<span style="color: black;">按照</span>freeswitch进行<span style="color: black;">调节</span>;号码<span style="color: black;">状况</span>:1005,1006-1019 共15个号码,同Appid下多个SRProxy 号码<span style="color: black;">不可</span>冲突</span>
<span style="color: black;">
</span>
<span style="color: black;">on</span>=<span style="color: black;">1</span> <span style="color: black;">## <span style="color: black;">是不是</span>开启SIP代理;0:不开启 1:开启</span>
<span style="color: black;">sip_account</span>=<span style="color: black;">1000</span> <span style="color: black;">## freeswitch代理账号:1000,客户端不可与此号码冲突;且一个SRProxy只能用一个号码,换个环境需换个号码,如:1001</span>
<span style="color: black;">sip_pwd</span>=<span style="color: black;">1234</span> <span style="color: black;">## freeswitch<span style="color: black;">秘码</span></span>
<span style="color: black;">rtm_account</span>=<span style="color: black;">1086</span> <span style="color: black;">## 登入RTM账号,客户端不可与此号码冲突,且一个appid只能用一个号码,换个环境需换个号码,如:1087</span>
<span style="color: black;">
</span>
<span style="color: black;">#* 0:SENSITIVE 1:VERBOSE 2:INFO 3:WARNING 4:ERROR 5:NONE</span>
<span style="color: black;">level</span>=<span style="color: black;">2</span>
<span style="color: black;">file</span>=rtc_sip.log
<span style="color: black;">max_file_size</span>=<span style="color: black;">100</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">配置<span style="color: black;">无</span>问题后<span style="color: black;">起步</span>SRProxy</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">进入目录:</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># cd /usr/local/ar4/srproxy/</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># rtx.sh start SRProxy ## <span style="color: black;">起步</span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># rtx.sh restart SRProxy ## 重启</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># rtx.sh stop SRProxy ## 停止</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">添加任务计划 实现自<span style="color: black;">起步</span></span></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># crontab -e</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">*/1 * * * * sh /usr/local/ar4/srproxy/moni_srp.sh >/dev/null 2>&1</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">Demo演示</h1>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">1、</span>登入ARCall (连接公网RTC、RTM)</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">ARCall源码下载<span style="color: black;">位置</span>: </p>https://github.com/anyRTC-UseCase/ARCall
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">配置AppId<span style="color: black;">必定</span>要和SRProxy 配置文件一致</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/d8d556b953854a5384d6ebf539c068a6~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=oQlllObP1P5zTIOkts9lrpijcBk%3D" style="width: 50%; margin-bottom: 20px;"></div>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">2、</span>登入sip(模拟<span style="color: black;">tel</span> 连接FreeSwitch)</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">下载<span style="color: black;">位置</span>:</p>https://www.microsip.org/downloads
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">连接的freeswitch<span style="color: black;">必定</span>要和SRProxy配置的一致</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">添加账户 点击Menu--->Add account</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/17b4705fe79e4aa2839809429af0cc9c~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=62TtlKAbUHAcSZRmpGLSYhd0xAc%3D" style="width: 50%; margin-bottom: 20px;"></div>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/6173c990b7174ea493c5a2ef477f2fa2~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=9PggxZUumyLoQOQhsLFeyidycmM%3D" style="width: 50%; margin-bottom: 20px;"></div>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">3、</span>ARCall拨打sip</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">ARCall拨打sip <span style="color: black;">运用</span>正常流程<span style="color: black;">就可</span>,号码多少就拨打多少</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">重视</span>: 拨打设备 <span style="color: black;">必定</span>要有麦克风才可拨通</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/a2286df31c99477d9dff5b7b21a47459~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=yu9R33R3KO3hvwF3x6jiMb7gCEQ%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">呼叫成功</span></span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/23962721c4474d1d99f1a5c2de260168~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=%2F4SZM9rAX1sWUBH81yvohquWet4%3D" style="width: 50%; margin-bottom: 20px;"></div>
<h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">4、</span>sip拨打ARCall</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">sip打ARCall需要前面加个0 ,<span style="color: black;">按照</span>配置Sip转发规则而定</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">重视</span>: 拨打设备 <span style="color: black;">必定</span>要有麦克风才可拨通</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/6fe669bd499b4ebea6f4f406c5064e59~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=Ff2gaAFUOYExNDav2EwTwuLEZaE%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">呼叫成功</span></span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/2a580822bfe846e5934a5ebf15b14bb5~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=XSxRHTY9XsJbC%2B4q9me%2Fr0DGNCg%3D" style="width: 50%; margin-bottom: 20px;"></div>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/f07ca7ef6ced4d10893b5b4f12afa656~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728782288&x-signature=wAHxtRxP69Xk6ssD2M5t26Bt290%3D" style="width: 50%; margin-bottom: 20px;"></div>
我深受你的启发,你的话语是我前进的动力。
页:
[1]