vhatami / asterisk-mstts Goto Github PK
View Code? Open in Web Editor NEWThis project forked from zaf/asterisk-mstts
Asterisk AGI script that makes use of Microsoft Translator text to speech service.
License: GNU General Public License v2.0
This project forked from zaf/asterisk-mstts
Asterisk AGI script that makes use of Microsoft Translator text to speech service.
License: GNU General Public License v2.0
============================================= Microsoft TTS script for Asterisk ============================================= This script makes use of Microsoft Translator text to speech service in order to redner 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 sox Sound eXchange, sound processing program mpg123 MPEG Audio Player and decoder Internet access in order to contact MS and get the voice data. To use this script you have to subscribe to the Microsoft Translator API on Azure Marketplace and register your application: https://datamarket.azure.com/developer/applications/ ------------ 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],[speed]): This will invoke the Microsoft 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). If 'speed' is set the speech rate is altered by that factor. The script contacts MS 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 microsoft text to speech test in english.",en) ;;Play message in Spanish exten => 1234,n,agi(mstts.agi,"Esta es una simple prueba en español.",es) ;;Play message in Japanese exten => 1234,n,agi(mstts.agi,"これは、日本の簡単なテストです。良い一日を。",ja) ;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 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,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() ------------------- Supported Languages ------------------- ca, ca-es, da, da-dk, de, de-de, en, en-au, en-ca, en-gb, en-in, en-us, es, es-es, es-mx, fi, fi-fi, fr, fr-ca, fr-fr, it, it-it, ja, ja-jp, ko, ko-kr, nb-no, nl, nl-nl, no, pl, pl-pl, pt, pt-br, pt-pt, ru, ru-ru, sv, sv-se, zh-chs, zh-cht, zh-cn, zh-hk, zh-tw ----------------------- 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/ --------------- API Description --------------- Request ------- GET http://api.microsofttranslator.com/V2/Http.svc/Speak Parameters ---------- appId Required. If the Authorization header is used, leave the appid field empty else a string containing "Bearer" + " " + access token. text Required. A string containing a sentence or sentences of the specified language to be spoken for the wave stream. language Required. A string representing the supported language code to speak the text in. The code must be present in the list of codes returned from the method GetLanguagesForSpeak. format Optional. A string specifying the content-type ID. Currently, "audio/wav" and "audio/mp3" are available. The default value is "audio/wav". options Optional. A string specifying the quality of the audio signals. Currently, "MaxQuality" and "MinSize" are available. With "MaxQuality", you can get the voice(s) with the highest quality, and with "MinSize", you can get the voices with the smallest size. If no value is provided, we default to "MinSize". Response -------- Returns a wave or mp3 stream of the passed-in text being spoken in the desired language.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.