1.查看網關注冊狀態(tài)
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下執(zhí)行l(wèi)ua腳本運行
如果通過客戶端執(zhí)行缀拭,可以調用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"/>
<!-- 回調監(jiān)聽地址 -- >
<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倦炒,如果系統(tǒng)不支持显沈,可能會刷如下錯誤信息,禁用即可
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