配置说明

[system]
ttsdir=/var/smartivr/tts
vaddir=/var/smartivr/vad
sounddir=/var/smartivr
apiurl=http://47.89.38.48/smartivr.php
[keda]
appid=59d5aaff
tts=/root/smartivr/tts
asr=/root/smartivr/asr

system 系统配置

  • ttsdir tts声音文件目录
  • vaddir vad录音文件目录
  • sounddir 系统声音目录
  • apiurl restful api 的URL

keda 科大讯飞接口配置

  • appid 科大讯飞云平台APPID
  • tts tts命令路径
  • asr asr命令路径

未整理

安装freeswitch

yum install git

git clone https://gitee.com/ddrj/freeswitch.git

cd freeswitch

git checkout v1.6.19


rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
### OR a European repository
rpm -ivh http://mirror.cedia.org.ec/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm

yum install gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel lua-devel libsndfile-devel opus-devel libshout-devel lame-devel libmpg123-devel yasm unzip


./bootstrap.sh -j

vi modules.conf
注释不需要编译的模块,如果你全部要编译忽略这一步骤


./configure -C


make


make install


ln -s /usr/local/freeswitch/bin/freeswitch /usr/local/bin/freeswitch

ln -s /usr/local/freeswitch/bin/fs_cli /usr/local/bin/fs_cli


阿里云不支持ipv6
/usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml
<param name="listen-ip" value="::"/>修改为
<param name="listen-ip" value="0.0.0.0"/>

删除
rm -rf /usr/local/freeswitch/conf/sip_profiles/internal-ipv6.xml
rm -rf /usr/local/freeswitch/conf/sip_profiles/external-ipv6.xml
rm -rf /usr/local/freeswitch/conf/sip_profiles/external-ipv6


为了安全修改SIP默认端口和分机默认密码
/usr/local/freeswitch/conf/vars.xml

<X-PRE-PROCESS cmd="set" data="default_password=1234"/>
1234修改为一个复杂的随机密码

<X-PRE-PROCESS cmd="set" data="internal_sip_port=5060"/>
<X-PRE-PROCESS cmd="set" data="external_sip_port=5080"/>
修改成其他随机端口


请根据自己情况修改编码
<X-PRE-PROCESS cmd="set" data="global_codec_prefs=OPUS,G722,PCMU,PCMA,VP8"/>
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=OPUS,G722,PCMU,PCMA,VP8"/>
OPUS G722 VP8删除了,修为
<X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMU,PCMA"/>
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA"/>


阿里云专有网络,请设置为公网IP
<X-PRE-PROCESS cmd="set" data="external_sip_ip=stun:stun.freeswitch.org"/>
<X-PRE-PROCESS cmd="set" data="external_rtp_ip=stun:stun.freeswitch.org"/>

/usr/local/freeswitch/conf/sip_profiles/external.xml
and
/usr/local/freeswitch/conf/sip_profiles/internal.xml

<param name="ext-rtp-ip" value="auto-nat"/>
<param name="ext-sip-ip" value="auto-nat"/>
修改为
<param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
<param name="ext-sip-ip" value="$${external_sip_ip}"/>


安装机器人模块

unzip vad.zip

cd mod_vad

获取授权

chmod +x machinecode
./machinecode
获取的机器码发到cdevelop@qq.com 获取授权码文件 放到
/etc/vad.license

安装mod_vad
cp mod_vad.so /usr/local/freeswitch/mod/

vi /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml
加入
<load module="mod_vad"/>

vi /usr/local/freeswitch/conf/dialplan/public/00_inbound_did.xml
加入
<extension name="smartivr">
<condition field="destination_number" expression="^(8888.*)$">
<action application="export" data="RECORD_STEREO=false"/>
<action application="set" data="record_file=$${recordings_dir}/${strftime(%Y-%m-%d)}/${caller_id_number}.$1.${strftime(%H-%M-%S)}.${uuid}.wav"/>
<action application="record_session" data="${record_file}"/>
<action application="socket" data="127.0.0.1:8040 full" />
</condition>
</extension>
请根据自己情况修改这个dialplan


安装 smartivr

cd ..


cp -r smartivr /var/smartivr

cd /var/smartivr/linux

chmod +x smartivr

设置api接口地址和asr key
vi smartivr.ini
apiurl=http://127.0.0.1/smartivr.php
asrtype=kedawebapi

[kedawebapi]
appid=5a519267
appkey=e212fc8e4c9747a39fa1c56940e705be
scene=main


如果你要后台运行smartivr 请用screen
yum install screen
screen -S smartivr
chmod +x smartivr
./smartivr
CTRL+A+D 返回
如果要次查看smartivr输出
screen -r smartivr



启动fs
freeswitch -nonat -nc