Skip to main content

mod_dptools: say

0. About

The say application will use the pre-recorded sound files to read or say various things like dates, times, digits, etc.

It can read digits, numbers, dollar amounts, date/time values, IP addresses, spell out alpha-numeric text, including punctuation marks, and so on.

There's a transcript of the pre-recorded files in the source under docs/phrase/phrase_en.xml.

Call the specific "type" say api as below. The method is used to modify the way the data is annunciated (counted, iterated, or pronounced).

1. Syntax

1.1 say

say <module_name>[:<lang>] <say_type> <say_method> [gender] <text>

Where

ParameterDescription
module_nameModule name is usually the channel language (such as en , es ).TODO Are these the available values?
say_typeAccepted values (from the source): NUMBER | ITEMSgeneral counts PERSONSMESSAGESCURRENCYmoney-related TIME_MEASUREMENTCURRENT_DATECURRENT_TIMEdates and times CURRENT_DATE_TIMESHORT_DATE_TIMENAME_SPELLEDspelling NAME_PHONETICTELEPHONE_NUMBER TELEPHONE_EXTENSION URL IP_ADDRESS EMAIL_ADDRESS POSTAL_ADDRESS ACCOUNT_NUMBER
say_methodAccepted values (from the source), and assuming the input value was "42":pronounced - cardinal number, e.g. "forty two"iterated - nominal number, e.g. "four two"counted - ordinal number, e.g. "forty second"TODO There is also N/A and PRONOUNCED_YEAR but not sure when the former is used.
genderAccepted values (from the source) for languages with gender-specific grammar (such as French or German): FEMININE MASCULINE NEUTER

1.2 say_string

say_string is a new method of doing say , and use it in mod_say_en and mod_say_ru . We can do more to centralize the say things, and go back and apply it to other languages. Using this method you can set the desired file extension as well.

say_string <module_name>[.<ext>] <lang>[.<ext>] <say_type> <say_method> [<say_gender>] <text> 

See 1.1 say section above for the parameter descriptions.

1.2.1 Usage

From CLI:

eval ${say_string en.gsm en current_date_time pronounced ${strepoch()}} 

From dialplan:

<action application="playback" data="${say_string en.wav en current_date_time pronounced ${strepoch()}}" /> 

2. Dialplan examples

<!-- use in a phrase macro, different from using in the dialplan-->
<action function="say" data="733#" method="iterated" type="name_spelled"/>

<!-- spelled out alpha-numeric + ascii code, like "a-b-seven-three-three-pound", ASCII code 32-47 and, 58-62, 92-122 -->
<action application="say" data="en name_spelled iterated ab733#"/>

<!-- spell out called number, like "one-two-three-four-five" -->
<action application="say" data="en name_spelled iterated ${destination_number}"/>

<!-- read number, like "twelve thousand, three hundred forty-five" -->
<action application="say" data="en number pronounced 12345"/>

<!-- read IP address, like "one two dot three four dot five six dot seven eight" -->
<action application="say" data="en ip_address iterated 12.34.56.78"/>

<!-- read IP address, like "twelve dot thirty-four dot fifty-six dot seventy-eight" -->
<action application="say" data="en ip_address pronounced 12.34.56.78"/>

<!-- pronounce a dollar value, even works for negatives, like "negative one dollar and ninety-six cents."-->
<action application="say" data="en CURRENCY PRONOUNCED -1.96"/>

<!-- pronounce a short date/time (like "Wednesday, 2:23PM") -- substitute [timestamp]
with a UTC timestamp -->
<action application="say" data="en short_date_time pronounced [timestamp]"/>

say <language> number works up to 999999999 (9 digits) in current languages.

2.1 Talking Clock

<extension name="Talking Clock Time" ><!--e.g. 10:56pm-->
<condition field="destination_number" expression="9190">
<action application="say" data="en CURRENT_TIME pronounced ${strepoch()}"/>
<action application="hangup"/>
</condition>
</extension>

<extension name="Talking Clock Date" ><!--e.g. March 8, 2011-->
<condition field="destination_number" expression="9191">
<action application="say" data="en CURRENT_DATE pronounced ${strepoch()}"/>
<action application="hangup"/>
</condition>
</extension>

<extension name="Talking Clock Date and Time" ><!--e.g. March 8, 2011 10:56pm-->
<condition field="destination_number" expression="9192">
<action application="say" data="en CURRENT_DATE_TIME pronounced ${strepoch()}"/>
<action application="hangup"/>
</condition>
</extension>

3. See Also