一.FreeSWITCH服务部署 1.wget http://www.freeswitch.org.cn/Makefile && make install 2.cd freeswitch 3.运行./bootstrap.sh(作用:初始化环境) 4.执行./configure(主要的作用是对即将安装的软件进行配置,检查当前的环境是否满足要安装软件的依赖关系,但并不是所有的tar包都是源代码的包) 5.make install 6.修改配置文件/usr/local/freeswitch/conf/vars.xml中的默认密码 <X-PRE-PROCESS cmd="set" data="default_password=1234"/> 7./usr/local/freeswitch/bin 执行 ./freeswitch -nc -nonat启动 执行 ./freeswitch -stop关闭 二.用户批量配置 /usr/local/freeswitch/conf/directory/default/2000.xml 1 <include> 2 <user id="2000" number-alias="root"> 3 <params> 4 <param name="password" value="123456"/> 5 <param name="reverse-auth-user" value="2000"/> 6 <param name="reverse-auth-pass" value="123456"/> 7 <param name="vm-password" value="c99ecff92015"/> 8 <param name="vm-enabled" value="true"/> 9 <param name="directory-exten-visible" value="true"/> 10 <param name="dial-string" value="{sip_invite_domain=${domain_name},leg_timeout=30,presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}"/> 11 </params> 12 <variables> 13 <variable name="domain_name" value="xxx.xxx.xxx.xxx"/> 14 <variable name="toll_allow" value=""/> 15 <variable name="user_context" value="default"/> 16 <variable name="directory-visible" value="true"/> 17 <variable name="limit_max" value="5"/> 18 <variable name="sip-force-contact" value="NDLB-connectile-dysfunction-2.0"/> 19 <variable name="sip-force-expires" value="180"/> 20 </variables> 21 </user> 22 </include> 批量生成用户脚本: 1 #!/bin/bash 2 for ((a=20000;a<=20010;a++)) ; 3 do 4 i=$(echo $a) 5 sed -e "s/2000/$i/" 2000.xml > $i.xml; 6 done 7 批量删除用户脚本: 1 #!/bin/bash 2 for ((a=10000;a<=200000;a++)) ; 3 do 4 i=$(echo $a) 5 rm $i.xml; 6 done 7 三.音频通话配置 /usr/local/freeswitch/conf/dialplan/public.xml||default.xml 1.一对一: <extension name="One_on_one"> <condition field="destination_number" expression="^(\d{5,6})$"> <action application="set" data="dialed_extension=$1" /> <action application="set" data="media_webrtc=true"/> <action application="bridge" data="user/${dialed_extension}@${domain}"/> </condition> </extension> 2.一对多(会议): 1 <extension name="nb_conferences"> 2 <condition field="destination_number" expression="^(\d{4})$"> 3 <action application="answer"/> 4 <action application="set" data="conference_auto_outcall_flags=none"/> 5 <action application="set" data="conference_auto_outcall_caller_id_name=$1"/> 6 <action application="set" data="conference_auto_outcall_caller_id_number=$1"/> 7 <action application="set" data="conference_auto_outcall_profile=default"/> 8 <action application="conference" data="$1-${domain_name}@default"/> 9 </condition> 10 </extension> 四.视频会议通话配置 在/usr/local/freeswitch/conf/vars.xml配置支持的视频编码 259 <X-PRE-PROCESS cmd="set" data="global_codec_prefs=OPUS,iLBC,G722,PCMU,PCMA,H263,H263-1998,H264,GSM,VP8,VP9"/> 260 <X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=OPUS,iLBC,G722,PCMU,PCMA,H263,H263-1998,H264,GSM,VP8,VP9"/> 配置用户路由 /usr/local/freeswitch/conf/dialplan/public.xml||default.xml 23 <extension name="cdquality_conferences"> 24 <!-- <condition field="destination_number" expression="^(35\d{2})$"> --> 25 <condition field="destination_number" expression="^(\d{4})$"> 26 <action application="answer"/> 27 <action application="conference" data="$1-${domain_name}@video-mcu-stereo"/> 28 </condition> 29 30 </extension> 而video-mcu-stereo是在文件 /usr/local/freeswitch/conf/autoload_configs/ 230 <profile name="video-mcu-stereo"> 231 <param name="domain" value="$${domain}"/> 232 <param name="rate" value="48000"/> 233 <param name="channels" value="1"/> 234 <param name="interval" value="20"/> 235 <!-- <param name="interval" value="auto"/> --> 236 <param name="energy-level" value="300"/> 237 <param name="auto-gain-level" value="2200"/> 238 <param name="caller-controls" value="none"/> 239 <!-- 240 <param name="tts-engine" value="flite"/> 241 <param name="tts-voice" value="kal16"/> 242 <param name="muted-sound" value="conference/conf-muted.wav"/> 243 <param name="unmuted-sound" value="conference/conf-unmuted.wav"/> 244 <param name="alone-sound" value="conference/conf-alone.wav"/> 245 <param name="moh-sound" value="$${hold_music}"/> 246 --> 247 <param name="enter-sound" value="tone_stream://%(200,0,500,600,700)"/> 248 <param name="exit-sound" value="conference/conf-goodbye.wav"/> 249 <!-- 250 <param name="auto-record" value="$${recordings_dir}/${conference_name}_${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/> 251 <param name="exit-sound" value="tone_stream://%(500,0,300,200,100,50,25)"/> 252 <param name="kicked-sound" value="conference/conf-kicked.wav"/> 253 <param name="locked-sound" value="conference/conf-locked.wav"/> 254 <param name="is-locked-sound" value="conference/conf-is-locked.wav"/> 255 <param name="is-unlocked-sound" value="conference/conf-is-unlocked.wav"/> 256 <param name="auto-record" value="/home/${conference_name}_${strftime(%Y-%m-%d-%H-%M-%S)}.mp4"/> 257 <param name="pin-sound" value="conference/conf-pin.wav"/> 258 <param name="bad-pin-sound" value="conference/conf-bad-pin.wav"/> 259 --> 260 <param name="caller-id-name" value="$${outbound_caller_name}"/> 261 <param name="caller-id-number" value="$${outbound_caller_id}"/> 262 263 <param name="comfort-noise" value="0"/> 264 <param name="conference-flags" value="video-floor-only|rfc-4579|livearray-sync|livearray-json-status|auto-3d-position|transcode-video|minimize-video-encoding"/> 265 <param name="video-mode" value="mux"/> 266 <param name="video-layout-name" value="4"/> 267 <!-- <param name="video-layout-name" value="group:grid"/> --> 268 <!-- 1280x720 800x600 --> 269 <param name="video-canvas-size" value="1280x720"/> 270 <param name="video-canvas-bgcolor" value="#333333"/> 271 <param name="video-layout-bgcolor" value="#000000"/> 272 <param name="video-codec-bandwidth" value="auto"/> 273 <param name="video-fps" value="25"/> 274 </profile> 275 五.通过sip trunk跟其他产品对接 配置sip trunk网关/usr/local/freeswitch/conf/sip_profiles/external/sip_trunk.xml 1 <include> 2 <gateway name="trunk.com"> 3 <param name="realm" value="xxx.xxx.xxx.xxx"/> 4 <param name="proxy" value="ip:port"/> 5 <param name="register" value="false"/> 6 </gateway> 7 </include> 配置路由/usr/local/freeswitch/conf/dialplan/public/000_sip_trunk.xml 1 <include> 2 <extension name="extension-trunk.com"> 3 <condition field="destination_number" expression="^0(\d+)$"> 4 <action application="set" data="dialed_extension=$1"/> 5 <action application="bridge" data="sofia/gateway/trunk.com/$1"/> 6 </condition> 7 </extension> 8 </include> 六.freeswitch在多网卡服务器下指定IP地址 修改internal.xml和external.xml 位置:/usr/local/freeswitch/conf/sip_profiles 修改内容: 64 <param name="rtp-ip" value="$${local_ip_v4}"/> 65 <param name="sip-ip" value="$${local_ip_v4}"/> 把$${local_ip_v4}改为指定的ip地址 七.权限问题 在使用sudo命令时,经常性会提示出“不在 sudoers 文件中。此事将被报告”的错误信息。 这是因为当前登录的账号不在sudo权限里面。 sudo命令可以让你以root身份执行命令,来完成一些我们这个帐号完成不了的任务。 其实并非所有用户都能够执行sudo,因为有权限的用户都在/etc/sudoers中 打开:/etc/sudoers 修改: # User privilege specification root ALL=(ALL:ALL) ALL username ALL=(ALL:ALL) ALL(添加的用户)
标签:xml,sip,部署,配置,freeswitch,usr,conf,FreeSWITCH,local From: https://www.cnblogs.com/kn-zheng/p/17388394.html