-
Notifications
You must be signed in to change notification settings - Fork 18
/
README
169 lines (150 loc) · 4.44 KB
/
README
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
=====================================================================
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/