FreeSWITCH fifo模块排队并动态播放排队位置
1. fs dialplan增加extension,将通话放置在队列中
<extension name="fifoQueue4CallTest"><condition field="destination_number" expression="^fifoQueue4CallTest$"><action application="set" data="fifo_music=local_stream://moh"/><!--<action application="set" data="fifo_chime_list=say:您拨打的客户正在通话中,请耐心等候"/>--><action application="set" data="fifo_chime_list=phrase:test_fifo_position:${uuid}"/><action application="set" data="fifo_chime_freq=15"/><action application="fifo" data="queuetest in"/></condition>
</extension>
上述配置,先设置排队等待音(fifo_music),在设置提示语(fifo_chime_list),这里的提示语用的是Parase短语+Macro的形式,可以在运行时再去解析获取具体播报内容,然后每隔15秒重复播报提示语,这些都设置好之后,进入队列
2. conf/lang/en/ivr/sounds.xml中加test_fifo_position Macro
<macro name="test_fifo_position"><input pattern="^(.*)$"><match><action function="speak-text" data="您拨打的电话正在通话中,您当前排在第${fifo_position}位"/></match></input>
</macro>
3. 修改conf/lang/en/en.xml配置文件,配置tts-engine和tts-voice
<include><language name="en" say-module="en" sound-prefix="$${sound_prefix}" tts_engine="unimrcp:hs-tts" tts_voice="xiaoruan" ><phrases><macros><X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml --><!-- voicemail_en_tts is purely implemented with tts, we have the files based one that is the default. --><X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/> <!-- vm/tts.xml if you want to use tts and have cepstral --><X-PRE-PROCESS cmd="include" data="dir/sounds.xml"/> <!-- dir/tts.xml if you want to use tts and have cepstral --><X-PRE-PROCESS cmd="include" data="ivr/*.xml"/> <!-- IVR and custom phrases go here --></macros><X-PRE-PROCESS cmd="include" data="vm/voicemail_ivr.xml"/></phrases></language></include>
然后fs_cli中reloadxml,进线即可听到对应的提示语