您的位置 首页 > 德语词汇

web proxy是什么意思、读音?技术分享|Sip与WebRTC互通-SRProxy开源库讲解

今天给各位分享web proxy是什么意思、读音的知识,其中也会对技术分享|Sip与WebRTC互通-SRProxy开源库讲解进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

目前WebRTC协议跟SIP协议互通场景主要运用在企业呼叫中心、企业内部通信、电话会议(PSTN)、智能门禁等场景,要想让WebRTC与SIP互通,要解决两个层面的问题:信令层媒体层。两个网络使用的信令机制不同,所以要进行信令的转换,才能完成媒体的协商,建立会话;媒体层要完成编码的转换,以及rtp/srtp转换等功能。anyRTC开源SRProxy网关,解决了WebRTC与SIP的协议转换,配合anyRTC开源的ARCall音视频呼叫demo,演示如何通过App/Web端呼叫落地,下文就如何使用部署SRProxy网关,以及如何跟ARCall互通进行展开,熟悉如何使用后,可集成SDK到自己的应用中,配合自身业务做对应的场景。

web proxy是什么意思、读音?技术分享|Sip与WebRTC互通-SRProxy开源库讲解

从上图简单概括一下:SRProxy是实现RTC和SIP之间业务互通的桥梁,更是实现业务拓展的关键服务。

呼叫邀请中,主叫可以通过[LocalInvitation]对象提供的[getState]方法查询当前呼叫邀请的有关状态;被叫可以通过SDK返回的[RemoteInvitation]对象的[getState]方法查询当前呼叫邀请的相关状态。

LocalInvitationState

下图描述了与主叫相关的呼叫邀请状态流转图:

RemoteInvitationState

下图描述了与被叫相关的呼叫邀请状态流转图:

取消已发送呼叫邀请

接受/拒绝呼叫邀请

注意事项及限制条件

到anyRTC官网注册一个开发者账号,并创建一个应用

Centos7.9最好是纯净服务器不然可能会存在依赖装不上或冲突情况

参考freeswitch防火墙:https://freeswitch.org/confluence/display/FREESWITCH/Firewall

#开放sip端口tcp协议\n[root@localhost~]#firewall-cmd--permanent--add-port=5060/tcp\n#开放sip端口udp协议\n[root@localhost~]#firewall-cmd--permanent--add-port=5060/udp\n#开放ws端口\n[root@localhost~]#firewall-cmd--permanent--add-port=5066/tcp\n#开放wss端口\n[root@localhost~]#firewall-cmd--permanent--add-port=7443/tcp\n#开放rtp端口(范围)\n[root@localhost~]#firewall-cmd--permanent--add-port=16384-32768/udp\n#让防火墙配置生效\n[root@localhost~]#firewall-cmd--reload\n\n#也可以直接关闭防火墙\n[root@localhost~]#systemctlstopfirewalld\n[root@localhost~]#systemctldisablefirewalld二、编译环境和FreeSwitch依赖库

#更新yum源\n[root@localhost~]#yumupdate-y\n\n#安装lib相关需求依赖\n[root@localhost~]#yuminstall-yyum-utilsgitgccgcc-c++automakeautoconflibtoollibtiff-devellibjpeg-developenssl-develvim\n\n#添加环境变量\n[root@localhost~]#vim/etc/profile\nexportPKG_CONFIG_PATH=/usr/local/lib/pkgconfig\n[root@localhost~]#source/etc/profile\n\n#单独下载spandsp源码\n[root@localhost~]#cd/usr/local/src\n[root@localhostsrc]#gitclonehttps://github.com/freeswitch/spandsp.git\n[root@localhostsrc]#cdspandsp\n[root@localhostspandsp]#./bootstrap.sh\n[root@localhostspandsp]#./configure\n[root@localhostspandsp]#make\n[root@localhostspandsp]#makeinstall\n[root@localhostspandsp]#ldconfig\n\n#单独下载sofia-sip(SIP协议栈)源码尝试使用过码云上面的,但是freeswitch编译的时候一直报错需要sofia-sip\n[root@localhost~]#cd/usr/local/src\n[root@localhostsrc]#gitclonehttps://github.com/freeswitch/sofia-sip.git\n[root@localhostsrc]#cdsofia-sip\n[root@localhostsofia-sip]#./bootstrap.sh-j\n[root@localhostsofia-sip]#./configure\n[root@localhostsofia-sip]#make\n[root@localhostsofia-sip]#makeinstall\n[root@localhostsofia-sip]#ldconfig\n\n#单独下载libuuid源码\n[root@localhost~]#cd/usr/local/src\n[root@localhostsrc]#wgethttps://jaist.dl.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz\n[root@localhostsrc]#tar-zxvflibuuid-1.0.3.tar.gz\n[root@localhostsrc]#cdlibuuid-1.0.3\n[root@localhostlibuuid-1.0.3]#./configure\n[root@localhostlibuuid-1.0.3]#make\n[root@localhostlibuuid-1.0.3]#makeinstall\n\n#编译安装cmake3.8.2\n[root@localhost~]#cd/usr/local/src\n[root@localhostsrc]#wgethttps://cmake.org/files/v3.8/cmake-3.8.2.tar.gz\n[root@localhostsrc]#tarzxvfcmake-3.8.2.tar.gz\n[root@localhostcmake]#cdcmake-3.8.2\n[root@localhostcmake-3.8.2]#./bootstrap\n[root@localhostcmake-3.8.2]#gmake\n[root@localhostcmake-3.8.2]#gmakeinstall\n\n#安装libatomic\n[root@localhost~]#yuminstall-ylibatomic\n\n#单独下载libks源码(需要cmake3.7.2以上版本)\n[root@localhost~]#cd/usr/local/src\n[root@localhostsrc]#gitclonehttps://github.com/signalwire/libks.git\n[root@localhostlibks]#cmake.\n##如果出现uuid错误,就重新编译libuuid源码,还是uuid错误就退出终端重新进入在执行cmake.\n[root@localhostlibks]#make\n[root@localhostlibks]#makeinstall\n\n#安装fs依赖\n[root@localhost~]#yuminstall-yhttp://files.freeswitch.org/freeswitch-release-1-6.noarch.rpmepel-release\n\n#安装ffmpeg需要\n[root@localhost~]#rpm--importhttp://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro\n[root@localhost~]#rpm-Uvhhttp://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm\n\n#yum安装相关依赖\n[root@localhost~]#yuminstall-yalsa-lib-develbisonbroadvoice-develbzip2curl-devellibdb4-devele2fsprogs-develerlangflite-develg722_1-develgdbm-develgnutls-develilbc2-develldns-devellibcodec2-devellibcurl-devellibedit-devellibidn-devellibmemcached-devellibogg-devellibsilk-devellibsndfile-devellibtheora-devellibuuid-devellibvorbis-devellibxml2-devellua-devellzo-develncurses-develnet-snmp-developus-develpcre-develperlperl-ExtUtils-Embedpkgconfigportaudio-develpostgresql-develpython-develpython-develsoundtouch-develspeex-develsqlite-develunbound-develunixODBC-develwhichyasmzlib-devellibshout-devellibmpg123-devellame-develrpm-buildlibX11-devellibyuv-develswigwgetffmpegffmpeg-devel\n\n#安装python组件\n[root@localhost~]#curlhttps://bootstrap.pypa.io/pip/2.7/get-pip.py--outputget-pip-2.7.py\n[root@localhost~]#pythonget-pip-2.7.py\n\n#验证pip是否安装成功\n[root@localhost~]#pip--version\n\n#pip安装python组件\n[root@localhost~]#pipinstallpydubpython-ESLpikadbutils三、安装FreeSwitch

#git下载freeswitch\n[root@localhost~]#gitclone-bv1.10https://github.com/signalwire/freeswitch.gitfreeswitch\n#如果github连接不顺畅的话,可以试试码云镜像仓库(更新慢1天)\n[root@localhost~]#gitclone-bv1.10https://gitee.com/mirrors/FreeSWITCH.gitfreeswitch\n\n#编译安装freeswitch前奏\n[root@localhost~]#cdfreeswitch\n[root@localhostfreeswitch]#./bootstrap.sh-j\n[root@localhostfreeswitch]#vimmodules.conf

根据需要打开或关闭注释

formats/mod_shout\nlanguages/mod_python\n#event_handlers/mod_cdr_pg_csv\nasr_tts/mod_unimrcp\nendpoints/mod_rtmp

如果需要使用mod_xml_curl的话

xml_int/mod_xml_curl

给不需要的模块加上注释

#applications/mod_av\n#applications/mod_signalwire

编译安装

[root@localhostfreeswitch]#./configure--with-python=/usr/bin/python2.7--with-lua=/usr/bin/lua--enable-core-pgsql-support\n\n#如果在spandsp位置报错,可以尝试执行下面这句在执行./configure\n[root@localhostfreeswitch]#exportPKG_CONFIG_PATH=/usr/local/lib/pkgconfig\n\n#编译freeswitch\n[root@localhostfreeswitch]#make\n\n#编译安装mod_cdr_pg_csv-install\n[root@localhostfreeswitch]#makemod_unimrcp-install\n\n#如果需要空上模块的话\n[root@localhostfreeswitch]#makemod_xml_curl-install\n\n#编译安装音频文件(英文)\n[root@localhostfreeswitch]#makecd-sounds-install\n[root@localhostfreeswitch]#makecd-moh-install\n\n#编译安装freeswitch\n[root@localhostfreeswitch]#makeinstall

额外安装音频文件(英文)

[root@localhostfreeswitch]#makeuhd-sounds-install\n[root@localhostfreeswitch]#makeuhd-moh-install\n[root@localhostfreeswitch]#makehd-sounds-install\n[root@localhostfreeswitch]#makehd-moh-install\n[root@localhostfreeswitch]#makesounds-install\n[root@localhostfreeswitch]#makemoh-install

建立软连接

[root@localhostfreeswitch]#sudoln-sf/usr/local/freeswitch/bin/freeswitch/usr/local/bin/\n[root@localhostfreeswitch]#sudoln-sf/usr/local/freeswitch/bin/fs_cli/usr/local/bin/

配置mod

[root@localhost~]#vim/usr/local/freeswitch/conf/autoload_configs/modules.conf.xml

在前3行开启(位置可能不对,能找到)

<loadmodule="mod_console"/>\n<loadmodule="mod_logfile"/>\n<loadmodule="mod_xml_curl"/>

打开注释

<loadmodule="mod_python"/>\n<loadmodule="mod_shout"/>

添加配置

<loadmodule="mod_cdr_pg_csv"/>\n<loadmodule="mod_unimrcp"/>\n<!--<loadmodule="mod_vad"/>-->

注释掉其他不需要的模块

<!--<loadmodule="mod_av"/>-->\n<!--<loadmodule="mod_signalwire"/>-->

如果没有其它要求部署freeswitch到这就可以结束了

[root@localhost~]#vim/usr/local/freeswitch/conf/autoload_configs/acl.conf.xml

<!--根据自己网络的实际情况进行配置(照抄大概率无效)-->\n<listname="domains"default="deny">\n<!--domain=isspecialitscansthedomainfromthedirectorytobuildt$-->\n<nodetype="allow"domain="$${domain}"/>\n<!--==================这里添加本机ip127.0.0.1========================-->\n<!--==================这里添加本机内网ip========================-->\n<!--==================这里添加本机外网ip========================-->\n<!--==================这里添加web内网ip192.168.1.221========================-->\n<!--==================这里添加web外网ip公网IP========================-->\n<!--==================这里添加runcall内外网Ip========================-->\n<nodetype="allow"cidr="192.168.1.0/24"/>\n<nodetype="allow"cidr="公网IP/32"/>\n</list>

#保存后,在freeswitch客户端,输入reloadaclreloadxml进行重新加载acl文件\n[root@localhost~]#fs_cli\nfreeswitch@localhost>reloadaclreloadxml

配置ESL

[root@localhost~]#vim/usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml

<configurationname="event_socket.conf"description="SocketClient">\n<settings>\n<paramname="nat-map"value="false"/>\n<!--ip统一为0.0.0.0-->\n<paramname="listen-ip"value="0.0.0.0"/>\n<!--端口号默认8021-->\n<paramname="listen-port"value="8021"/>\n<!--密码统一Aicyber-->\n<paramname="password"value="Aicyber"/>\n<!--允许acl白名单内的IP访问-->\n<paramname="apply-inbound-acl"value="domains"/>\n<!--<paramname="apply-inbound-acl"value="loopback.auto"/>-->\n<!--<paramname="stop-on-bind-error"value="true"/>-->\n</settings>\n</configuration>

适配WebRTC(JSSIP/SIPJS)

[root@localhost~]#vim/usr/local/freeswitch/conf/sip_profiles/internal.xml

<paramname="apply-candidate-acl"value="rfc1918.auto"/>\n<paramname="apply-candidate-acl"value="localnet.auto"/>\n<paramname="apply-candidate-acl"value="candidate"/>\n<!--取消注释这一行(让前端可以得到早期媒体)-->\n<paramname="enable-100rel"value="true"/>

拨号计划

[root@localhost~]#vim/usr/local/freeswitch/conf/sip_profiles/internal.xml

<!--默认是public-->\n<paramname="context"value="default"/>

关闭ipv6

[root@localhost~]#cd/usr/local/freeswitch/conf/sip_profiles\n[root@localhostsip_profiles]#mvinternal-ipv6.xmlinternal-ipv6.xml.removed\n[root@localhostsip_profiles]#mvexternal-ipv6.xmlexternal-ipv6.xml.removed四:配置Sip的Proxy转发规则

[root@localhost~]#vim/usr/local/freeswitch/conf/dialplan/default.xml##配置文件中加入以下配置,多个SRProxy就配置多个号码

<extensionname="group_dial_sip_proxy">\n<conditionfield="destination_number"expression="^0(.*)$">\n<actionapplication="set"><![CDATA[sip_h_X-Number=<sip:$1@${domain_name}>]]></action>\n<actionapplication="bridge"data="user/1000@192.168.x.xx"/>\n</condition>\n</extension>

意思是:如果呼叫的SIP号码前面加0,则自动路由到1000号码上;这个1000号码是SRProxy中配置的Proxy账号,这样SRProxy就可以收到Sip外呼的请求,从发对RTC发起呼叫。

注:配置中192.168.x.xx是你机器的真实IP,有公网EIP填公网EIP地址,局域网则填局域网IP地址。

安装完freeswitch发现进行sip呼叫的时候出现差不多延时10秒左右才能接收呼叫主要原因是freeswitch中默认配置了延时时间只需要注释掉就能解决这个问题

[root@localhostfreeswitch]#vim/usr/local/freeswitch/conf/dialplan/default.xml

<conditionfield="${default_password}"expression="^1234$"break="never">\n<actionapplication="log"data="CRITWARNINGWARNINGWARNINGWARNINGWARNINGWARNINGWARNINGWARNINGWARNING"/>\n<actionapplication="log"data="CRITOpen$${conf_dir}/vars.xmlandchangethedefault_password."/>\n<actionapplication="log"data="CRITOncechangedtype'reloadxml'attheconsole."/>\n<actionapplication="log"data="CRITWARNINGWARNINGWARNINGWARNINGWARNINGWARNINGWARNINGWARNINGWARNING"/>\n<!--<actionapplication="sleep"data="10000"/>-->#注释这一行即可\n</condition>

启动生效

[root@localhostfreeswitch]#cd/usr/local/freeswitch/conf/directory/default[root@localhostdefault]#vim1000.xml

<include>\n<userid="1000">\n<params>\n<paramname="password"value="$${default_password}"/>\n<paramname="vm-password"value="1000"/>\n</params>\n<variables>\n<variablename="toll_allow"value="domestic,international,local"/>\n<variablename="accountcode"value="1000"/>\n<variablename="user_context"value="default"/>\n<!--<variablename="effective_caller_id_name"value="Extension1000"/>-->#注释\n<!--<variablename="effective_caller_id_number"value="1000"/>-->#注释这两行\n<variablename="outbound_caller_id_name"value="$${outbound_caller_name}"/>\n<variablename="outbound_caller_id_number"value="$${outbound_caller_id}"/>\n<variablename="callgroup"value="techsupport"/>\n</variables>\n</user>\n</include>

启动生效

##后台快速启动\n[root@localhost~]#freeswitch-nc-nonat\n\n##控制台启动(退出即关闭服务)\n[root@localhost~]#freeswitch七、FreeSwitch自动增加号码

freeswitch是一个开源的呼叫中心服务,默认号码是1000-1019只有20个号码时,无法满足时,需要增加号码使用

[root@localhost~]#vim/usr/local/freeswitch/conf/dialplan/default.xml

<extensionname="Local_Extension">\n<!--<conditionfield="destination_number"expression="^(10[01][0-9])$">-->#注释这一行或者修改这一行\n<conditionfield="destination_number"expression="^(1[0-9][0-9][0-9]|20[0-9][0-9])$">#重新定义号码段段为1000~2099\n<actionapplication="export"data="dialed_extension=$1"/>\n<!--bind_meta_appcanhavetheseargs<key>[a|b|ab][a|b|o|s]<app>-->\n<actionapplication="bind_meta_app"data="1bsexecute_extension::dxXMLfeatures"/>

[root@localhost~]#freeswitch.sh

#!/bin/bash\n#Author:lzy\n#data:2021-11-16\n\n#设置变量\n#freeswitch存放号码目录\nTARGET_FREESWITCH_PREFIX=/usr/local/freeswitch/conf/directory/default/\n#因为默认已经有1000-1019所以设置从1020开始,可以随时改\ni=1020\n\n#设置循环,-le小于等于2099结束\nwhile[$i-le2599]\ndo\n#i=$i+1$i=1020逐步往上+1\nleti=$i+1\n#cp复制1000.xml重命名$i逐步+1\ncp$TARGET_FREESWITCH_PREFIX/1000.xml$TARGET_FREESWITCH_PREFIX/$i.xml\n#sed将1000.xml文件里面的1000改为文件本身的数值\nsed-i"s/1000/$i/"$TARGET_FREESWITCH_PREFIX/$i.xml\ndone

##脚本授权执行脚本\n[root@localhost~]#chmod+xfreeswitch.sh\n[root@localhost~]#./freeswitch.sh\n\n##保存后,在freeswitch客户端,输入reloadxml进行重新加载.xml文件\n[root@localhost~]#fs_cli\nfreeswitch@localhost>reloadxml部署SRProxy

源码地址:https://github.com/anyRTC-UseCase/SipRtcProxy

双击:SipRtcProxy.sln,直接运行

项目是VS2017创建,VS2015,VS2019可自行验证。

[root@localhost~]#gitclonehttps://github.com/anyRTC-UseCase/SipRtcProxy.git

[root@localhost~]#cdSipRtcProxy.git

[root@localhostSipRtcProxy]#vim/etc/profile\nexportLD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/SipRtcProxy/so/\n[root@localhostSipRtcProxy]#source/etc/profile

执行

[root@localhostSipRtcProxy]#make

[root@localhostSipRtcProxy]#vimrtx.conf

[global]\nappid=XXXXX##创建应用时注册的Appid\nsip_svr=IP:5060##freeswitch_IP地址和端口,目前仅支持freeswitch默认端口\n\n##配置私有云RTC环境注释默认连接公网环境\n#[rtc]\n#ip=RTC_IP\n#port=6080\n\n##配置私有云RTM环境注释默认连接公网环境\n#[rtm]\n#ip=RTM_IP\n#port=7080\n\n[rtm2sip]\non=1##是否开启RTM2SIP;0:不开启1:开启\nacc_rule=1005;10[06-19]##号码范围根据freeswitch进行调整;号码情况:1005,1006-1019共15个号码,同Appid下多个SRProxy号码不能冲突\n\n[proxy]\non=1##是否开启SIP代理;0:不开启1:开启\nsip_account=1000##freeswitch代理账号:1000,客户端不可与此号码冲突;且一个SRProxy只能用一个号码,换个环境需换个号码,如:1001\nsip_pwd=1234##freeswitch密码\nrtm_account=1086##登入RTM账号,客户端不可与此号码冲突,且一个appid只能用一个号码,换个环境需换个号码,如:1087\n\n[log]\n#*0:SENSITIVE1:VERBOSE2:INFO3:WARNING4:ERROR5:NONE\nlevel=2\nfile=rtc_sip.log\nmax_file_size=100

前台启动

[root@localhostSipRtcProxy]#./SRProxyrtx.conf

下载地址:https://pan.baidu.com/s/1QhhIsO3NEf9olX19xVxBKg

[root@localhost~]#mkdir/usr/local/ar4/

[root@localhost~]#tarzxvfSRProxy.tar.gz

将srproxy.tar.gz放到/usr/local/ar4/解压

[root@localhost~]#cd/usr/local/ar4/

[root@localhostar4]#tarzxvfsrproxy.tar.gz

将rtx.sh脚本放入/usr/bin下面并赋予权限

[root@localhost~]#chmod+x/usr/bin/rtx.sh

[root@localhost~]#cd/usr/local/ar4/srproxy/[root@localhostsrproxy]#vimconf/rtx.conf

[global]\nappid=XXXXX##创建应用时注册的Appid\nsip_svr=IP:5060##freeswitch_IP地址和端口,目前仅支持freeswitch默认端口\n\n##配置私有云RTC环境注释默认连接公网环境\n#[rtc]\n#ip=RTC_IP\n#port=6080\n\n##配置私有云RTM环境注释默认连接公网环境\n#[rtm]\n#ip=RTM_IP\n#port=7080\n\n[rtm2sip]\non=1##是否开启RTM2SIP;0:不开启1:开启\nacc_rule=1005;10[06-19]##号码范围根据freeswitch进行调整;号码情况:1005,1006-1019共15个号码,同Appid下多个SRProxy号码不能冲突\n\n[proxy]\non=1##是否开启SIP代理;0:不开启1:开启\nsip_account=1000##freeswitch代理账号:1000,客户端不可与此号码冲突;且一个SRProxy只能用一个号码,换个环境需换个号码,如:1001\nsip_pwd=1234##freeswitch密码\nrtm_account=1086##登入RTM账号,客户端不可与此号码冲突,且一个appid只能用一个号码,换个环境需换个号码,如:1087\n\n[log]\n#*0:SENSITIVE1:VERBOSE2:INFO3:WARNING4:ERROR5:NONE\nlevel=2\nfile=rtc_sip.log\nmax_file_size=100

配置没有问题后启动SRProxy

[root@localhost~]#cd/usr/local/ar4/srproxy/

[root@localhostsrproxy]#rtx.shstartSRProxy##启动

[root@localhostsrproxy]#rtx.shrestartSRProxy##重启

[root@localhostsrproxy]#rtx.shstopSRProxy##停止

*/1****sh/usr/local/ar4/srproxy/moni_srp.sh>/dev/null2>&1

ARCall源码下载地址:https://github.com/anyRTC-UseCase/ARCall

配置AppId一定要和SRProxy配置文件一致

下载地址:https://www.microsip.org/downloads

连接的freeswitch一定要和SRProxy配置的一致

添加账户点击Menu--->Addaccount

ARCall拨打sip使用正常流程即可,号码多少就拨打多少

注意:拨打设备一定要有麦克风才可拨通

sip打ARCall需要前面加个0,根据配置Sip转发规则而定

注意:拨打设备一定要有麦克风才可拨通

关于web proxy是什么意思、读音和技术分享|Sip与WebRTC互通-SRProxy开源库讲解的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

本站涵盖的内容、图片、视频等数据,部分未能与原作者取得联系。若涉及版权问题,请及时通知我们并提供相关证明材料,我们将及时予以删除!谢谢大家的理解与支持!

Copyright © 2023