美文网首页
FreeSwitch配置手记

FreeSwitch配置手记

作者: yulong_vip | 来源:发表于2017-10-14 20:53 被阅读0次

    ==NAT 设置==

    ===修改 /usr/local/freeswitch/conf/var===
     注释掉:
     <X-PRE-PROCESS cmd="set" data="external_sip_ip=stun:stun.freeswitch.org"/> 
     换成
     <X-PRE-PROCESS cmd="set" data="external_sip_ip=*.*.*.*"/>
     <X-PRE-PROCESS cmd="set" data="external_rtp_ip=stun:stun.freeswitch.org"/>
     换成
     <X-PRE-PROCESS cmd="set" data="external_rtp_ip=xxx.xxx.xxx.xxx"/>
    
    ===修改/usr/local/freeswitch/conf/sip_profiles/external.xml===
      修改为
      <param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
      <param name="ext-sip-ip" value="$${external_sip_ip}"/>
    
    ===修改修改/usr/local/freeswitch/conf/sip_profiles/internal.xml===
     <param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
     <param name="ext-sip-ip" value="$${external_sip_ip}"/>
    
    ===查看nat 设置===
     sofia status profile internal
    

    页面访问freeswitch lua时需要用户名和密码

    ===xml_rpc.conf.xml===
      <configuration name="xml_rpc.conf" description="XML RPC">
      <settings>
        <!-- The port where you want to run the http service (default 8080) -->
        <param name="http-port" value="8080"/>
        <!-- if all 3 of the following params exist all http traffic will require auth -->
        <param name="auth-realm" value="user"/>
        <param name="auth-user" value="user"/>
        <param name="auth-pass" value="password"/>
       </settings>
      </configuration>
    

    radius 模块相关配置

    打开mod_radius_cdr
        <!-- Event Handlers -->
        <load module="mod_cdr_csv"/>
        <!-- <load module="mod_cdr_sqlite"/> -->
        <!-- <load module="mod_event_multicast"/> -->
        <load module="mod_event_socket"/>
        <!-- <load module="mod_event_zmq"/> -->
        <!-- <load module="mod_zeroconf"/> -->
        <!-- <load module="mod_erlang_event"/> -->
        <!-- <load module="mod_snmp"/> -->
        <load module="mod_radius_cdr"/>
       重启freeswitch 生效
       fs_cli -x 'fsctl shutdown restart'
    
    ===mod_radius_cdr.conf.xml===
      如果在/usr/local/freeswitch/conf/autoload_configs
      /usr/local/freeswitch/mod/上要加mod_radius_cdr.la ;mod_radius_cdr.so 的模块,然后重启freeswitch。
      vi mod_radius_cdr.conf.xml
      <configuration name="mod_radius_cdr.conf" description="RADIUS CDR Configuration">
              <settings>
                    <!-- location of the radius dictionary file -->
                    <param name="dictionary" value="/usr/local/freeswitch/conf/radius/dictionary"/>
                    <!-- location of the radius sequence file -->
                    <param name="seqfile" value="/usr/local/var/run/freeswitch/radius.seq"/>
                    <!-- accounting servers, up to 8 allowed -->
                    <!-- value is "host:port:secret", port is optional -->
                    <!-- use IP ADDRESSES, not hostnames -->
    
                    <param name="acctserver" value="xxx.xxx.xxx.xxx:1813:password"/>       
                  
                    <!-- number of retries for each server -->
                    <param name="radius_retries" value="3"/>
                    <!-- number of seconds to wait between retries -->
                    <param name="radius_timeout" value="5"/>
                    <!-- The length of time in seconds that we skip a nonresponsive RADIUS
                             server for transaction requests. Server(s) being in the "dead" state
                             are tried only after all other non-dead servers have been tried and
                             failed or timeouted. The deadtime interval starts when the server
                             does not respond to an authentication/accounting request transmissions.
                             When the interval expires, the "dead" server would be re-tried again,
                             and if it's still down then it will be considered "dead" for another
                             such interval and so on. This option is no-op if there is only one
                             server in the list. Set to 0 in order to disable the feature. -->
                    <param name="radius_deadtime" value="0"/>
              </settings>
      </configuration>
    

    ==中文语音包==

    ===上传中文包到 /usr/local/freeswitch/sounds/===
    :下载文件: [[文件:Freeswitch-sounds-zh-cn-link-8000-1.0.0.tar.gz]] 上传
     cd /usr/local/freeswitch/sounds
    tar -zxvf freeswitch-sounds-zh-cn-link-8000-1.0.0.tar.gz
    ===增加中文定义===
     cd /usr/local/freeswitch/conf/lang
     cp -a en zh
     cd zh
     mv en.xml cn.xml
    
    ===编辑cn.xml===
    :将cn.xml第2行换成
     <language name="zh" say-module="zh" sound-prefix="$${sounds_dir}/zh/cn/link" tts-engine="cepstral" tts-voice="callie">
    ===增加对中文的加载===
    编辑/usr/local/freeswitch/conf/freeswitch.xml,找到<section name="languages" description="Language Management">段,加入
     <X-PRE-PROCESS cmd="include" data="lang/zh/*.xml"/>
    ===增加中文say模块的加载===
    :编辑/usr/local/freeswitch/conf/autoload_configs/modules.conf.xml
     去除<load module="mod_say_zh"/>的注释
    ===设置中文为默认语言===
    :编辑/usr/local/freeswitch/conf/vars.xml,加入以下几行
      <X-PRE-PROCESS cmd="set" data="default_language=zh"/>
      <X-PRE-PROCESS cmd="set" data="default_dialect=cn"/>
      <X-PRE-PROCESS cmd="set" data="default_voice=link"/>
    ===重新加载xml===
    :在fs_cli
     reloadxml
    

    ==freeswitch lua 通话超时自动挂断==

    {execute_on_answer='sched_hangup +"..calltime.."'} calltime为允许通话的时间,单位为秒
    
    freeswitch.Session("{origination_uuid= "..matchcode.."}{execute_on_answer='sched_hangup +"..calltime.."'}
    

    ==freeswitch调节通话声音大小==

    位于拨号计划中设置set_audio_level参数
     <extension name="public_did">
         <condition field="destination_number" expression="^00(\d+)$">
           <action application="set" data="domain_name=127.0.0.1"/>
           <action application="set" data="ignore_early_media=true"/>
           <action application="set_audio_level" data="read 4"/>
           <action application="set_audio_level" data="write 4"/>
          <action application="lua" data="callfromkamailio.lua"/>
        </condition>
      </extension>
    

    acl.conf.xml
    设置允许ip及域名

    switch.conf.xml
    设置rtp端口

    相关文章

      网友评论

          本文标题:FreeSwitch配置手记

          本文链接:https://www.haomeiwen.com/subject/hlmfuxtx.html