Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: cab5daf604
Fetching contributors…

Cannot retrieve contributors at this time

file 214 lines (197 sloc) 5.897 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
=============================================
       Google TTS script for Asterisk
=============================================

This script makes use of Google's translate 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
mpg123 MPEG Audio Player and decoder
Internet access in order to contact google and get the voice data.

------------
Installation
------------
To install copy googletts.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(googletts.agi,"text",[language],[intkey],[speed]): This will invoke the Google 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 (defaults to 1.2).

The script contacts google's 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

;GoogleTTS Demo
;PLayback messages to user

exten => 1234,1,Answer()
    ;;Play mesage in English:
exten => 1234,n,agi(googletts.agi,"This is a simple google text to speech test in english.",en)
    ;;Play message in Spanish
exten => 1234,n,agi(googletts.agi,"Esta es una simple prueba en español.",es)
    ;;Play message in Greek
exten => 1234,n,agi(googletts.agi,"Αυτό είναι ένα απλό τέστ στα ελληνικά.",el)

;A simple dynamic IVR using GoogleTTS

[my_ivr]
exten => s,1,Answer()
exten => s,n,Set(TIMEOUT(digit)=5)
exten => s,n,agi(googletts.agi,"Welcome to my small interactive voice response menu.",en)
    ;;Wait for digit:
exten => s,n(start),agi(googletts.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(googletts.agi,"You just pressed ${EXTEN}. Try another one please.",en,any)
exten => _X,n,WaitExten()

exten => i,1,agi(googletts.agi,"Invalid extension.",en)
exten => i,n,goto(s,start)

exten => t,1,agi(googletts.agi,"Request timed out.",en)
exten => t,n,goto(s,start)

exten => h,1,Hangup()

-------------------
Supported Languages
-------------------
Afrikaans: af
Albanian: sq
Amharic: am
Arabic: ar
Armenian: hy
Azerbaijani: az
Basque: eu
Belarusian: be
Bengali: bn
Bihari: bh
Bosnian: bs
Breton: br
Bulgarian: bg
Cambodian: km
Catalan: ca
Chinese Simplified: zh-CN
Chinese Traditional:zh-TW
Corsican: co
Croatian: hr
Czech: cs
Danish: da
Dutch: nl
English: en
Esperanto: eo
Estonian: et
Faroese: fo
Filipino: tl
Finnish: fi
French: fr
Frisian: fy
Galician: gl
Georgian: ka
German: de
Greek: el
Guarani: gn
Gujarati: gu
Hacker: xx-hacker
Hausa: ha
Hebrew: iw
Hindi: hi
Hungarian: hu
Icelandic: is
Indonesian: id
Interlingua: ia
Irish: ga
Italian: it
Japanese: ja
Javanese: jw
Kannada: kn
Kazakh: kk
Kinyarwanda: rw
Kirundi: rn
Klingon: xx-klingon
Korean: ko
Kurdish: ku
Kyrgyz: ky
Laothian: lo
Latin: la
Latvian: lv
Lingala: ln
Lithuanian: lt
Macedonian: mk
Malagasy: mg
Malay: ms
Malayalam: ml
Maltese: mt
Maori: mi
Marathi: mr
Moldavian: mo
Mongolian: mn
Montenegrin: sr-ME
Nepali: ne
Norwegian: no
Norwegian Nynorsk: nn
Occitan: oc
Oriya: or
Oromo: om
Pashto: ps
Persian: fa
Pirate: xx-pirate
Polish: pl
Portuguese: pt
Portuguese Brazil: pt-BR
Portuguese Portugal:pt-PT
Punjabi: pa
Quechua: qu
Romanian: ro
Romansh: rm
Russian: ru
Scots Gaelic: gd
Serbian: sr
Serbo-Croatian: sh
Sesotho: st
Shona: sn
Sindhi: sd
Sinhalese: si
Slovak: sk
Slovenian: sl
Somali: so
Spanish: es
Sundanese: su
Swahili: sw
Swedish: sv
Tajik: tg
Tamil: ta
Tatar: tt
Telugu: te
Thai: th
Tigrinya: ti
Tonga: to
Turkish: tr
Turkmen: tk
Twi: tw
Uighur: ug
Ukrainian: uk
Urdu: ur
Uzbek: uz
Vietnamese: vi
Welsh: cy
Xhosa: xh
Yiddish: yi
Yoruba: yo
Zulu: zu

-------
License
-------
The GoogleTTS script for asterisk is distributed under the GNU General Public
License v2. See COPYING for details.

--------
Homepage
--------
http://zaf.github.com/asterisk-googletts/
Something went wrong with that request. Please try again.