Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Asterisk AGI script that makes use of Microsoft Translator text to speech service.
Perl
tag: v0.2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
cli
COPYING
ChangeLog
README
authors
mstts.agi

README

=============================================
      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
sox          Sound eXchange, sound processing program
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:
https://datamarket.azure.com/developer/applications/

Existing API Keys from http://www.bing.com/developers/appids.aspx
still work but they are considered deprecated and this method is no longer supported.

------------
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]): This will invoke the MS Translator 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 (for use in IVR).

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

-------
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/
Something went wrong with that request. Please try again.