Freeswitch: mod_phrase

Speak a phrase of text using a predefined phrase macro.

For more information on TTS, see mod_cepstralmod_unimrcp, and UniMRCP.

conf/ denotes the main configuration directory, and to find out its location, use

 $ fs_cli -x 'eval $${conf_dir}}'
 

* the former can only be used in phrase macros, and  * the latter are applications that can be used in dialplans, event socket applications, etc.

See Speech Phrase Management for the full list of phrase macro actions.|

 phrase <macro_name>,<data>

2.1 Without phrases

 <extension name="556"> 
   <condition field="destination_number" expression="^556$">
     <action application="answer"/>
     <action application="sleep" data="1000"/>
     <action application="phrase" data="spell,${caller_id_name}"/>
     <action application="phrase" data="spell-phonetic,${caller_id_name}"/>
     <action application="phrase" data="timespec,12:45:15"/>
     <action application="phrase" data="saydate,0"/>
     <action application="phrase" data="msgcount,130"/>
   </condition>
 </extension>
 

2.2 With phrases

Following is a sample of phrases management:

 <section name="phrases" description="Speech Phrase Management">
    <macros>
      <language name="en" sound_path="/snds" tts_engine="cepstral" tts_voice="david">
        <macro name="msgcount">
          <input pattern="(.*)">
            <action function="execute" data="sleep(1000)"/>
            <action function="play-file" data="vm-youhave.wav"/>
            <action function="say" data="$1" method="pronounced" type="items"/>
            <action function="play-file" data="vm-messages.wav"/>
          </input>
        </macro>
        <macro name="saydate">
          <input pattern="(.*)">
            <action function="say" data="$1" method="pronounced" type="current_date_time"/>
          </input>
        </macro>
        <macro name="timespec">
          <input pattern="(.*)">
            <action function="say" data="$1" method="pronounced" type="time_measurement"/>
          </input>
        </macro>
        <macro name="spell">
          <input pattern="(.*)">
            <action function="say" data="$1" method="pronounced" type="name_spelled"/>
          </input>
        </macro>
        <macro name="spell-phonetic">
          <input pattern="(.*)">
            <action function="say" data="$1" method="pronounced" type="name_phonetic"/>
          </input>
        </macro>
        <macro name="tts-timeleft">
          <input pattern="(\d+):(\d+)">
            <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
          </input>
        </macro>
      </language>
      <language name="fr" sound_path="/var/sounds/lang/fr/jean" tts_engine="cepstral" tts_voice="jean-pierre">
        <macro name="msgcount">
          <input pattern="(.*)">
            <action function="play-file" data="tuas.wav"/>
            <action function="say" data="$1" method="pronounced" type="items"/>
            <action function="play-file" data="messages.wav"/>
          </input>
        </macro>
        <macro name="timeleft">
          <input pattern="(\d+):(\d+)">
            <action function="speak-text" data="il y a $1 minutes et de $2 secondes de restant"/>
          </input>
        </macro>
      </language>
    </macros>
  </section>
 
  • freeswitch/mod/mod_phrase.txt
  • Последние изменения: 2020/08/06