Now, to output text to speech on an open source Asterisk PBX platform, you can use the Microsoft translator.
The presented script will allow you to use Microsoft Translator to play the user's text to speech. It includes local caching for voice data, contains many languages in its database, and also supports 8 kHz or 16 kHz rates. This will provide the best sound quality, along with the use of broadband codecs.
')
Dependencies:perl: the perl programming language
perl-libwww: The World-Wide Web library for Perl
sox: Sound eXchange, sound processing program
API Key (appid) from Microsoft, i.e. Internet access to communicate with MS and receive voice data.
Installation:To install a copy of mstts.agi to the agi-bin directory.
/ var / lib / asterisk / agi-bin /To make sure that the file is installed:
/etc/asterisk/asterisk.conf fileUsing:agi (mstts.agi, text, [language], [intkey])This command activates the MS TTS Engine translator, which will translate a text string to speech and reproduce it for the user.
If 'intkey' is already installed, the script will prompt for user input. The interrupt key on it will immediately stop playing and the dialing started, in order to go to the appropriate extension (for use in IVR) TTS contact scripts from Microsoft. Voice data, which is then stored in the local cache (default default / tmp) for future use.
The user can set the language and parameters for using the cache memory and the cache directory in the default settings.
Asterisk Dialplan:; MsTTS Demo
exten => 1234,1, Answer ()
;; Play mesage in English:
exten => 1234, n, agi (mstts.agi, "Communication has been waiting.", en)
;; Play message in Spanish:
exten => 1234, n, agi (mstts.agi, "La comunicación se ha estado esperando.", es)
;; Play message in Japanese:
exten => 1234, n, agi (mstts.agi, "こ れ は 、 日本 の 簡 簡 な な テ ス ト で す。。 良 い 一日 を。", ja)
;; Play message in simplified Chinese:
exten => 1234, n, agi (mstts.agi, "が 待 っ て い る", zh-cn)
; A simple dynamic IVR using MsTTS
[my_ivr]
exten => s, 1, Answer ()
exten => s, n, Set (TIMEOUT (digit) = 5)
exten => s, n, agi (mstts.agi, "Welcome to my small interactive voice response menu.", en)
;; Wait for digit:
exten => s, n (start), agi (mstts.agi, "Please dial a digit.", en, any)
exten => s, n, WaitExten ()
;; PLayback for another one:
exten => _X, 1, agi (mstts.agi, "You just pressed $ {EXTEN}. Try another one please.", en, any)
exten => _X, n, WaitExten ()
exten => i, 1, agi (mstts.agi, "Invalid extension.", en)
exten => i, n, goto (s, start)
exten => t, 1, agi (mstts.agi, "Request timed out.", en)
exten => t, n, goto (s, start)
exten => h, 1, Hangup ()License:MS Translator TTS script for asterisk is distributed under the terms of the GNU General Public License version 2
Download the latest stable version
here.MyAsterisk collected and translated the information for you .