Skip to content
项目

zaf/asterisk-googletts

在 GitHub 查看

关于

Asterisk AGI script that uses Google's translate text to speech service.

人工智能与机器学习

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
+1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文
=============================================
       Google TTS script for Asterisk
=============================================

This script uses the Google Translate text-to-speech service to render
text as speech and play it back to the user. It supports a variety of languages.

This TTS service is unofficial and not supported by Google; it can be
changed or terminated at any point without warning. People looking for TTS
solutions to base their projects or products on should use an officially
supported service.

------------
Requirements
------------
Perl                    The Perl Programming Language
perl-libwww             The World-Wide Web library for Perl
perl-LWP-Protocol-https For HTTPS support
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.
The usual location is /var/lib/asterisk/agi-bin/.
Check /etc/asterisk/asterisk.conf for the configured directory.

-----
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 specified keys can interrupt playback. An interrupt key
immediately terminates playback and causes the dialplan to proceed to the
matching extension (this is mainly for use in IVR; see the examples below).
If 'speed' is set the speech rate is altered by that factor (defaults to 1).

The script contacts Google's TTS service and stores the resulting audio
in a local cache (by default /tmp/) for future use. Default language, output
sample rate, speed, caching, and cache directory settings can be changed by
editing the variables near the top of the script.

--------
Examples
--------
Sample dialplan code for your extensions.conf

;GoogleTTS Demo
;Play messages back to the user

exten => 1234,1,Answer()
    ;;Play message 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()

    ;;Play 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
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
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
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

-----------------------
Security Considerations
-----------------------
This script contacts Google servers in order to get voice data.
The script uses TLS to encrypt traffic between your PBX and these servers.
Submitted text is available to Google and is subject to Google's privacy
policy and terms of service.

------------
Tiny version
------------
The '-tiny' suffixed scripts use the HTTP::Tiny Perl module instead of
LWP::UserAgent. This can make them faster on small embedded systems or boards
like the Raspberry Pi. They expose the same interface and CLI arguments as the
standard versions and require HTTP::Tiny.
On Debian- or Ubuntu-based distributions: 'apt-get install libhttp-tiny-perl'
On distributions without the package in their repositories: 'cpan HTTP::Tiny'
The tiny AGI script requires MP3 format support in SoX, assumes SoX is
installed at /usr/bin/sox, defaults to 8 kHz audio and SoX 14, and does not use
mpg123. The tiny CLI script still requires mpg123.

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

--------
Homepage
--------
https://zaf.github.io/asterisk-googletts

探索相关项目

加载中…