===================================================================== Microsoft Azure Cognitive Services TTS script for Asterisk ===================================================================== This script makes use of Microsoft Azure text to speech API in order to render text to speech and play it back to the user. It supports a variety of different languages. ------------ Requirements ------------ Perl The Perl Programming Language perl-libwww The World-Wide Web library for Perl perl-Crypt-SSLeay or perl-IO-Socket-SSL for use of SSL/TLS encryption Internet access in order to contact MS and get the voice data. ------------ Installation ------------ To install copy mstts.agi to your agi-bin directory. Usually this is /var/lib/asterisk/agi-bin/ To make sure check your /etc/asterisk/asterisk.conf file ----- Usage ----- agi(mstts.agi,"text",[language],[intkey],[gender]): This will invoke the Azure TTS engine, render the text string to speech and play it back to the user. If 'intkey' is set the script will wait for user input. Any given interrupt keys will cause the playback to immediately terminate and the dialplan to proceed to the matching extension (this is mainly for use in IVR, see README for examples). The script contacts MS Azure TTS service in order to get the voice data which then stores in a local cache (by default /tmp/) for future use. Parameters like default language, enabling or disabling caching and cache dir can be set up by editing the script. -------- Examples -------- sample dialplan code for your extensions.conf ;MSTTS Demo ;PLayback messages to user exten => 1234,1,Answer() ;;Play mesage in English: exten => 1234,n,agi(mstts.agi,"This is a simple bing text to speech test in English.",en-US) ;;Play message in Spanish with a female voice: exten => 1234,n,agi(mstts.agi,"Esta es una simple prueba en español.",es-ES,,f) ;;Play message in Japanese with a male voice: exten => 1234,n,agi(mstts.agi,"これは、日本の簡単なテストです。良い一日を。",ja-JP,,m) ;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-US) ;;Wait for digit: exten => s,n(start),agi(mstts.agi,"Please dial a digit.",en-US,any) exten => s,n,WaitExten() ;;Playback the name of the digit and wait for another one: exten => _X,1,agi(mstts.agi,"You just pressed ${EXTEN}. Try another one please.",en-US,any) exten => _X,n,WaitExten() exten => i,1,agi(mstts.agi,"Invalid extension.",en-US) exten => i,n,goto(s,start) exten => t,1,agi(mstts.agi,"Request timed out.",en-US) exten => t,n,goto(s,start) exten => h,1,Hangup() ------------------- Supported Languages ------------------- ar-EG-Female zh-CN-Female zh-HK-Female el-GR-Male cs-CZ-Male es-ES-Male ro-RO-Male ru-RU-Female ar-SA-Male pl-PL-Female en-GB-Female ms-MY-Male de-DE-Female fr-FR-Female pt-BR-Female sl-SI-Male ca-ES-Female fr-CA-Female es-MX-Male bg-BG-Male hu-HU-Male fr-CH-Male en-US-Female en-IN-Female pt-PT-Female hi-IN-Male zh-TW-Male ja-JP-Male tr-TR-Female fi-FI-Female nl-NL-Female de-CH-Male pt-BR-Male fr-FR-Male en-GB-Male de-DE-Male sv-SE-Female hr-HR-Male ta-IN-Male ru-RU-Male en-CA-Female es-ES-Female th-TH-Male id-ID-Male zh-HK-Male vi-VN-Male zh-CN-Male ko-KR-Female en-IE-Male en-US-Male en-IN-Male zh-TW-Female ja-JP-Female hi-IN-Female sk-SK-Male en-AU-Female es-MX-Female de-AT-Male it-IT-Male nb-NO-Female da-DK-Female he-IL-Male ----------------------- Security Considerations ----------------------- This script contacts MS servers in order to get speech data. The script uses TLS to encrypt all the traffic between your pbx and MS servers so no 3rd party can eavesdrop your communication. ------------ Tiny version ------------ The '-tiny' suffixed scripts use the HTTP::Tiny perl module instead of LWP::UserAgent. This makes them a lot faster when run in small embedded systems or boards like the Raspberry pi. They can be used as an in-place replacement of the normal versions of the TTS scripts and expose the same interface/cli args. To use them just make sure you have HTTP::Tiny installed. In debian or ubuntu based distros: 'apt-get install libhttp-tiny-perl' In distros that don't have it in their repos: 'cpan HTTP::Tiny' ------- License ------- The MStts script for asterisk is distributed under the GNU General Public License v2. See COPYING for details. -------- Homepage -------- http://zaf.github.com/asterisk-mstts/
zaf/asterisk-mstts
Asterisk AGI script that makes use of Microsoft Azure Cognitive Services for text to speech synthesis
PerlGPL-2.0