1.查看网关注册状态
sofia status
2.桥接(未实践) http://wiki.freeswitch.org.cn/wiki/Mod_lua.html#jump10237
freeswitch.bridge
session1 = freeswitch.Session("sofia/internal/1001%192.168.1.1");
session2 = freeswitch.Session("sofia/internal/1002%192.168.1.1");
freeswitch.bridge(session1, session2);
http://wiki.freeswitch.org.cn/wiki/Mod_lua.html#jump10237
3.diaplan脚本中先呼叫一方,再转接另一方
prefix = "{ignore_early_media=true}sofia/192.168.150.132/"
file_to_play = "/usr/local/freeswitch/sounds/custom/8000/sound.wav"
function call_number(number)
dial_string = prefix .. tostring(number);
-- debug("calling " .. dial_string);
session = freeswitch.Session(dial_string);
session:setAutoHangup(false)
session:transfer("5002", "XML", "default")
return session:hangupCause()
end
hangup_cause = call_number("1012")
freeswitch下执行lua脚本运行
如果通过客户端执行,可以调用fs_cli ,调用完成后退出客户端命令如下:
bin/fs_cli -x "luarun autodia.lua param1
4.fs_cli连接不上问题
a.可以看8021端口是否使用,如果是的
相关配置文件 conf/autoload_configs/event_socket.conf.xml
<configuration name="event_socket.conf" description="Socket Client">
<settings>
<param name="nat-map" value="false"/>
- <param name="listen-ip" value="::"/>
+ <param name="listen-ip" value="127.0.0.1"/>
<param name="listen-port" value="8021"/>
<param name="password" value="ClueCon"/>
- <!--<param name="apply-inbound-acl" value="loopback.auto"/>-->
- <!--<param name="stop-on-bind-error" value="true"/>-->
+ <!--<param name="apply-inbound-acl" value="lan"/>-->
</settings>
</configuration>
配置改成如下配置即可
按 Ctrl+C 复制代码
按 Ctrl+C 复制代码
b. ip最好改成本机,否者仍有可能拒绝访问
5.FREESWITCH转接语音到MRCP Server接收到的音频音质极差问题
一般是FREEWTICH与终端的音频编码和与MRCP Server的编码不一致导致(终端音频码率较高),FS进行转码时失真过大,SF转码能力可能有些欠缺。通过修改FREESWITCH 目录下conf/vars.xml 将 global_codec_prefs 配置限制为MRCP Server能够接收的编码即可。
<pre style="margin: 0px; padding: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;"><X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMU,PCMA"/></pre>
6.单模块编译安装
当已经安装好freeswitch,需要安装一个未安装的模块步骤
1.进入freeswitch-version源码目录
修改module.conf 启动你的安装的模块如mod_json_cdr
2.进入src/mod目录下,make mod_json_cdr
3.在src/mod目录下 make mod_json_cdr-install
4.在FREESWITCH控制台 load mod_json_cdr
7.集成mod_unimrcp 并对接unimrcpserver
a.FREESWITCH源码根路径下,修改modules.conf文件,取消“asr_tts/mod_unimrcp”配置的注释
b. make mod_unimrcp;make mod_unimrcp-install 集成mod_unimrcp模块
c.切换到安装目录。新建文件conf/mrcp_profiles/unimrcpserver-mrcp-v2.xml,具体配置如下,注意修改ip和端口
<include>
<!-- UniMRCP Server MRCPv2 -->
<!-- 后面我们使用该配置文件,均使用 name 作为唯一标识,而不是文件名 -->
<profile name="unimrcpserver-mrcp2" version="2">
<!-- MRCP 服务器地址 -->
<param name="server-ip" value="127.0.0.1"/>
<!-- MRCP SIP 端口号 -->
<param name="server-port" value="8060"/>
<!-- <param name="resource-location" value=""/> -->
<!-- FreeSWITCH IP、端口以及 SIP 传输方式 -->
<param name="client-ip" value="127.0.0.1" />
<param name="client-port" value="5069"/>
<param name="sip-transport" value="udp"/>
<!-- <param name="speechsynth" value="speechsynthesizer"/> -->
<!-- <param name="speechrecog" value="speechrecognizer"/> -->
<!--param name="rtp-ext-ip" value="auto"/-->
<param name="rtp-ip" value="127.0.0.1"/>
<param name="rtp-port-min" value="4000"/>
<param name="rtp-port-max" value="5000"/>
<param name="codecs" value="PCMU PCMA L16/96/8000"/>
<!-- Add any default MRCP params for SPEAK requests here -->
<synthparams>
</synthparams>
<!-- Add any default MRCP params for RECOGNIZE requests here -->
<recogparams>
<!--param name="start-input-timers" value="false"/-->
</recogparams>
</profile>
</include></pre>
d.conf/autoload_configs/unimrcp.conf.xml修改配置,将mrcp对接server选择为上面配置的server,使用profile name熟悉值
<!-- UniMRCP profile to use for TTS -->
<param name="default-tts-profile" value="unimrcpserver-mrcp2"/>
<!-- UniMRCP profile to use for ASR -->
<param name="default-asr-profile" value="unimrcpserver-mrcp2"/></pre>
e. conf/autoload_configs/modules.conf.xml增加如下配置项,让fs启动时自动加载该模块
<load module="mod_unimrcp" />
8.sip、rtp对接配置,修改conf/sip_profiles/external.xml。如果走的是代理等网络,需要视情况将auto-nat改为外部ip(如果本机即有外部ip或者对端支持nat,则可能不需要配置)。
<param name="ext-rtp-ip" value="auto-nat"/>
<param name="ext-sip-ip" value="auto-nat"/>
9.对接mod_format_cdr
a.编译安装模块,同上
b.启用模块,同上
c.配置,修改 conf/autoload_configs/format_cdr.conf.xml,其中几个配置项需要修改
<!-- 配置格式 -- >
<param name="format" value="json"/>
<!-- 回调监听地址 -- >
<param name="url" value="http://sms-agent-idc.vpc.tencentyun.com/aicsCall/cdr/callRecord.do"/>
<!-- key格式配置,appljson可以传递jsonbody,但是header处理似乎有问题,只能是application/x-www-form-urlencoded,因此使用默认配置 -- >
<param name="encode" value="true"/>
<!-- val是否进行URL编码 -- >
<param name="encode-values" value="false"/>
10.禁用ipv6,如果系统不支持,可能会刷如下错误信息,禁用即可
2018-09-14 17:55:34.161271 [ERR] sofia.c:3146 Error Creating SIP UA for profile: external-ipv6 (sip:mod_sofia@[::1]:5080;transport=udp,tcp) ATTEMPT 2 (RETRY IN 5 SEC)
2018-09-14 17:55:34.161271 [ERR] sofia.c:3146 Error Creating SIP UA for profile: internal-ipv6 (sip:mod_sofia@[::1]:5060;transport=udp,tcp) ATTEMPT 2 (RETRY IN 5 SEC)
2018-09-14 17:55:39.161270 [ERR] sofia.c:3146 Error Creating SIP UA for profile: external-ipv6 (sip:mod_sofia@[::1]:5080;transport=udp,tcp) ATTEMPT 3 (RETRY IN 5 SEC)
2018-09-14 17:55:39.161270 [ERR] sofia.c:3156 Error Creating SIP UA for profile: external-ipv6 (sip:mod_sofia@[::1]:5080;transport=udp,tcp)
The likely causes for this are:
- Another application is already listening on the specified address.
- The IP the profile is attempting to bind to is not local to this system.
2018-09-14 17:55:39.161270 [ERR] sofia.c:3146 Error Creating SIP UA for profile: internal-ipv6 (sip:mod_sofia@[::1]:5060;transport=udp,tcp) ATTEMPT 3 (RETRY IN 5 SEC)
2018-09-14 17:55:39.161270 [ERR] sofia.c:3156 Error Creating SIP UA for profile: internal-ipv6 (sip:mod_sofia@[::1]:5060;transport=udp,tcp)
The likely causes for this are: - Another application is already listening on the specified address.
- The IP the profile is attempting to bind to is not local to this system.
禁用方式:
mv conf/sip_profiles/internal-ipv6.xml conf/sip_profiles/internal-ipv6.xml.bk
mv conf/sip_profiles/external-ipv6.xml conf/sip_profiles/external-ipv6.xml.bk