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

Parameter

Description

module_name

Module name is usually the channel language (such as en , es ).

TODO Are these the available values? 

say_type 

Accepted values (from the source):

NUMBER    |

ITEMS     | general counts

PERSONS   |

MESSAGES  |

 

CURRENCY    | money-related

 

TIME_MEASUREMENT    |

CURRENT_DATE        |

CURRENT_TIME        | dates and times

CURRENT_DATE_TIME   |

SHORT_DATE_TIME     |

 

NAME_SPELLED    | spelling

NAME_PHONETIC   |

 

TELEPHONE_NUMBER

TELEPHONE_EXTENSION

URL

IP_ADDRESS

EMAIL_ADDRESS

POSTAL_ADDRESS

ACCOUNT_NUMBER

say_method 

Accepted 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.

gender 

Accepted 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>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值