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脚本中先呼叫一方,再转接另一方
[](javascript:void(0); "复制代码")
<pre style="margin-top: 0px; margin-bottom: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;"> 1 prefix = "{ignore_early_media=true}sofia/192.168.150.132/"
2 file_to_play = "/usr/local/freeswitch/sounds/custom/8000/sound.wav"
3
4 function call_number(number) 5 dial_string = prefix .. tostring(number);
6 -- debug("calling " .. dial_string);
7 session = freeswitch.Session(dial_string); 8 session:setAutoHangup(false)
9 session:transfer("5002", "XML", "default") 10 return session:hangupCause() 11 end
12 hangup_cause = call_number("1012")</pre>
](javascript:void(0); "复制代码")
freeswitch下执行lua脚本运行
<pre style="margin-top: 0px; margin-bottom: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;">luarun autodia.lua param1</pre>
如果通过客户端执行,可以调用fs_cli ,调用完成后退出客户端命令如下:
<pre style="margin-top: 0px; margin-bottom: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;">bin/fs_cli -x "luarun autodia.lua param1"</pre>
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"/>
-
</settings>
</configuration>
配置改成如下配置即可
[](javascript:void(0); "复制代码")
<pre style="margin-top: 0px; margin-bottom: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;"><configuration name="event_socket.conf" description="Socket Client">
<settings>
<param name="nat-map" value="false"/>
<param name="listen-ip" value="127.0.0.1"/>
<param name="listen-port" value="8021"/>
<param name="password" value="ClueCon"/>
</settings>
</configuration></pre>
](javascript:void(0); "复制代码")
b. ip最好改成本机,否者仍有可能拒绝访问
5.FREESWITCH转接语音到MRCP Server接收到的音频音质极差问题
一般是FREEWTICH与终端的音频编码和与MRCP Server的编码不一致导致(终端音频码率较高),FS进行转码时失真过大,SF转码能力可能有些欠缺。通过修改FREESWITCH 目录下conf/vars.xml 将 global_codec_prefs 配置限制为MRCP Server能够接收的编码即可。
<pre style="margin-top: 0px; margin-bottom: 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和端口
[](javascript:void(0); "复制代码")
<pre style="margin-top: 0px; margin-bottom: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;"><include>
<profile name="unimrcpserver-mrcp2" version="2">
<param name="server-ip" value="127.0.0.1"/>
<param name="server-port" value="8060"/>
<!-- 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>
](javascript:void(0); "复制代码")
d.conf/autoload_configs/unimrcp.conf.xml修改配置,将mrcp对接server选择为上面配置的server,使用profile name熟悉值
<pre style="margin-top: 0px; margin-bottom: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;">
<param name="default-tts-profile" value="unimrcpserver-mrcp2"/>
<param name="default-asr-profile" value="unimrcpserver-mrcp2"/></pre>
e. conf/autoload_configs/modules.conf.xml增加如下配置项,让fs启动时自动加载该模块
<pre style="margin-top: 0px; margin-bottom: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;"><load module="mod_unimrcp" /></pre>
8.sip、rtp对接配置,修改conf/sip_profiles/external.xml。如果走的是代理等网络,需要视情况将auto-nat改为外部ip(如果本机即有外部ip或者对端支持nat,则可能不需要配置)。
<pre style="margin-top: 0px; margin-bottom: 0px; white-space: pre-wrap; word-wrap: break-word; font-family: "Courier New" !important; font-size: 12px !important;"> <param name="ext-rtp-ip" value="auto-nat"/>
<param name="ext-sip-ip" value="auto-nat"/></pre>
9.对接mod_format_cdr
a.编译安装模块,同上
b.启用模块,同上
c.配置,修改 conf/autoload_configs/format_cdr.conf.xml,其中几个配置项需要修改
[](javascript:void(0); "复制代码")