Skip to main content

mod_dptools: phrase


Table of Contents (click to expand)


0. About

Speak a phrase of text using a predefined phrase macro.

For more information on TTS, see mod_cepstral, mod_unimrcp, and UniMRCP.

See also the Speech Phrase Management page for more information and examples. The phrase command relies on the configuration in the phrases section of the conf/freeswitch.xml file (see Configuring FreeSWITCH), and XML files in conf/lang/en/*.xml.

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

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

On speak-text and play-file

speak-text and play-file phrase macro actions are very similar in functionality to mod_dptools: playback and mod_dptools: speak respectively, but

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

1. Usage

phrase <macro_name>,<data>

2. Examples

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>