zaf / asterisk-googletts Goto Github PK
View Code? Open in Web Editor NEWAsterisk AGI script that uses Google's translate text to speech service.
License: GNU General Public License v2.0
Asterisk AGI script that uses Google's translate text to speech service.
License: GNU General Public License v2.0
Hi,
Getting an error "Failed to fetch speech data. at /usr/bin/googletts-cli.pl line 126." since few days. Just wondering if there's any update that would be coming in soon?
Thanks for your help.
Hi,
When asterisk is in normal run mode, tts does not render any sound. However when start in foreground with verbosity, the TTS works normally.
I try with centOS 5.7 and CentOS 6.2 with different version of mpg123.
Hey. Check this out
https://github.com/mahirgul/GoogleTTSFor.Net
Thanks a lot for great tool, it's very handy.
Recently googletts stops talking)) I have checked debug output and here it is:
-- : Unexpected result:
-- : Text passed for synthesis: testing testing testing.
-- : Language: en, Interrupt keys: , Sample rate: 8000
-- : Speed: 1.3, Caching: 1, Cache dir: /tmp
-- : URL passed: https://translate.google.com/translate_tts?ie=UTF-8&q=testing%20testing%20testing.&tl=en&total=1&idx=0&client=t
-- : Failed to fetch file.
-- : Cleaning temp files.
Is there some kind of problem with fetching the file from google?
Hope you can help me to fix it.
Thanks in advance!
I use project to speech communicates in Polish language and i need to change voice to female.
Is it possible? how can i do it?
On a fresh centos with astersiknow 11 I try to use asterisk-googletts on a simple extension:
exten => 995,1,Answer
exten => 995,2,agi(googletts.agi,"Il motore di sintetizzazione della voce",it)
exten => 995,3,agi(googletts.agi,"è stato installato",it)
exten => 995,4,agi(googletts.agi,"Arrivederci e grazie.",it)
exten => 995,5,HangUp
The console output is:
Connected to Asterisk 11.2.1 currently running on localhost (pid = 4148)
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
-- Executing [995@from-internal:1] Answer("SIP/101-00000000", "") in new stack
-- Executing [995@from-internal:2] AGI("SIP/101-00000000", "googletts.agi,"Il motore di sintetizzazione della voce",it") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
-- <SIP/101-00000000>AGI Script googletts.agi completed, returning 0
-- Executing [995@from-internal:3] AGI("SIP/101-00000000", "googletts.agi,"è stato installato",it") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
-- <SIP/101-00000000>AGI Script googletts.agi completed, returning 0
-- Executing [995@from-internal:4] AGI("SIP/101-00000000", "googletts.agi,"Arrivederci e grazie.",it") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
-- <SIP/101-00000000>AGI Script googletts.agi completed, returning 0
-- Executing [995@from-internal:5] Hangup("SIP/101-00000000", "") in new stack
== Spawn extension (from-internal, 995, 5) exited non-zero on 'SIP/101-00000000'
-- Executing [h@from-internal:1] Hangup("SIP/101-00000000", "") in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/101-00000000'
localhost*CLI>
googletts.agi return state 0 that indicate success, but no sound is produced on the phone.
Where I'm wrong?
I have similar issue using speech-recog.agi
Thanks in advance
how to change to new voices from google cloud text-to-speech ?
I have 64 bit Centos 7.1.1503, Asterisk 11.19.0 with Incredible GUI 2.11.0.34.
I updated googletts.agi with the 7/29/15 code, but I do not get any sound even though the built-in gsm files playback. I have sox, and mpg123 installed. Further
yum install...
Package 4:perl-5.16.3-285.el7.x86_64 already installed and latest version
Package perl-Crypt-SSLeay-0.64-5.el7.x86_64 already installed and latest version
No package perl-libwww available.
I have internet connection running. I ran asterisk -vvvvvvvvvvvvvvvvr and I can see the string being called with asterisk.agi:
AGI("SIP/701-00000004", "googletts.agi,"This Top Stories news update brought to you by Yahoo and Nerd Viddles. From Yahoo Finance: Wall Street tumbles in volatile action amid global rout. From Reuters: How a New Orleans church found salvation from Katrina in Texas. From Reuters: How President Bernie Sanders would handle foreign policy. From Reuters: New Orleans' finances still vulnerable 10 years after Katrina: Moody's. From Reuters: Judge to decide whether Pennsylvania official will face perjury trial. From Reuters: Researchers sample enormous oceanic trash vortex ahead of clean-up proposal. From Associated Press: Americans Briton who thwarted attack get France's top honor. From Associated Press: IndyCar driver Justin Wilson in coma after wreck at Pocono. From Associated Press: How Trump would pull off his immigration plan. Have a nice day. Goodbye.",en") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
-- <SIP/701-00000004>AGI Script googletts.agi completed, returning 0
-- Executing [951@from-internal:8] Hangup("SIP/701-00000004", "") in new stack
== Spawn extension (from-internal, 951, 8) exited non-zero on 'SIP/701-00000004'
-- Executing [h@from-internal:1] Hangup("SIP/701-00000004", "") in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/701-00000004'
The Hangup string happens almost immediately.
QUESTIONS:
How do I check to see if I have the perl-libwww installed?
How can I debug googletts.agi from the linux command line?
Where can I find the temporary wav file?
My asterisk defaults to gsm, will it also work with wav?
-- Executing [1234@from-internal:2] AGI("SIP/126-00000319", "googletts.agi,"This is a simple google text to speech test in english.",en") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
<SIP/126-00000319>AGI Tx >> agi_request: googletts.agi
<SIP/126-00000319>AGI Tx >> agi_channel: SIP/126-00000319
<SIP/126-00000319>AGI Tx >> agi_language: ru
<SIP/126-00000319>AGI Tx >> agi_type: SIP
<SIP/126-00000319>AGI Tx >> agi_uniqueid: 1477571818.1201
<SIP/126-00000319>AGI Tx >> agi_version: 11.21.2
<SIP/126-00000319>AGI Tx >> agi_callerid: 126
<SIP/126-00000319>AGI Tx >> agi_calleridname: unknown
<SIP/126-00000319>AGI Tx >> agi_callingpres: 1
<SIP/126-00000319>AGI Tx >> agi_callingani2: 0
<SIP/126-00000319>AGI Tx >> agi_callington: 0
<SIP/126-00000319>AGI Tx >> agi_callingtns: 0
<SIP/126-00000319>AGI Tx >> agi_dnid: 1234
<SIP/126-00000319>AGI Tx >> agi_rdnis: unknown
<SIP/126-00000319>AGI Tx >> agi_context: from-internal
<SIP/126-00000319>AGI Tx >> agi_extension: 1234
<SIP/126-00000319>AGI Tx >> agi_priority: 2
<SIP/126-00000319>AGI Tx >> agi_enhanced: 0.0
<SIP/126-00000319>AGI Tx >> agi_accountcode:
<SIP/126-00000319>AGI Tx >> agi_threadid: 140020954314496
<SIP/126-00000319>AGI Tx >> agi_arg_1: This is a simple google text to speech test in english.
<SIP/126-00000319>AGI Tx >> agi_arg_2: en
<SIP/126-00000319>AGI Tx >>
<SIP/126-00000319>AGI Rx << CHANNEL STATUS
<SIP/126-00000319>AGI Tx >> 200 result=6
<SIP/126-00000319>AGI Rx << GET FULL VARIABLE ${CHANNEL(audionativeformat)}
<SIP/126-00000319>AGI Tx >> 200 result=1 ((alaw))
<SIP/126-00000319>AGI Rx << NOOP " -- googletts.agi: Failed to fetch file: "
<SIP/126-00000319>AGI Tx >> 200 result=0
<SIP/126-00000319>AGI Rx << NOOP " -- googletts.agi: 500"
<SIP/126-00000319>AGI Tx >> 200 result=0
<SIP/126-00000319>AGI Rx << NOOP " -- googletts.agi: Can't connect to translate.google.com:443 (connect: Connection refused)"
<SIP/126-00000319>AGI Tx >> 200 result=0
-- <SIP/126-00000319>AGI Script googletts.agi completed, returning 0
I've noticed Google text-to-speech demo has a Wavenet option which makes the audio perfect.
Is there any way we can support this?
Hello,
We´re planning on buying a API key for the Google TTS service.
Where do I insert this key, once I have it ?
How can execute the AGIA from the originate applicate ?
originate SIP/13053053005@outbound-trunk application agi googletts.agi,"Testing google agi",en,any
Hi,
The sample rate is set at 8000 in my googletts.agi script, yet when calling the script from the dialplan, the console has this to say:
[Jan 4 01:30:45] WARNING[20433][C-0000000f]: format_wav.c:112 check_header_fmt: Unexpected frequency mismatch 16000 (expecting 8000)
[Jan 4 01:30:45] WARNING[20433][C-0000000f]: file.c:395 fn_wrapper: Unable to open format wav
Or even
[Jan 4 01:25:12] WARNING[20195][C-0000000d]: format_wav.c:112 check_header_fmt: Unexpected frequency mismatch 22050 (expecting 8000)
[Jan 4 01:25:12] WARNING[20195][C-0000000d]: file.c:395 fn_wrapper: Unable to open format wav
core show version
Asterisk 11.1.0 built by abuild @ build22 on a x86_64 running Linux on 2012-12-21 23:25:47 UTC
cat /proc/version
Linux version 3.4.11-2.16-default (geeko@buildhost) (gcc version 4.7.1 20120723 [gcc-4_7-branch revision 189773](SUSE Linux) ) #1 SMP Wed Sep 26 17:05:00 UTC 2012 (259fc87)
perl -v
This is perl 5, version 16, subversion 0 (v5.16.0) built for x86_64-linux-thread-multi
sox --version
sox: SoX v14.4.0
mpg123 --version
mpg123 1.14.4
Script returns 0 without playback. The file isnt created on /tmp/ cache.
Asterisk 1.8.8.2
perl v5.8.8
Asterisk debug:
-- Executing [inicio@URA:1] AGI("SIP/gw114.phono.com-00000014", "googletts.agi,"This is a simple google text to speech test in english.",en") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_request: googletts.agi
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_channel: SIP/gw114.phono.com-00000014
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_language: en
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_type: SIP
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_uniqueid: 1328211461.20
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_version: 1.8.8.2
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_callerid: f4450186-bd63-4bff-b427-80aad3f07474
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_calleridname: unknown
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_callingpres: 0
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_callingani2: 0
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_callington: 0
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_callingtns: 0
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_dnid: 2000
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_rdnis: unknown
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_context: URA
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_extension: inicio
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_priority: 1
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_enhanced: 0.0
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_accountcode:
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_threadid: 1079167296
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_arg_1: This is a simple google text to speech test in english.
<SIP/gw114.phono.com-00000014>AGI Tx >> agi_arg_2: en
<SIP/gw114.phono.com-00000014>AGI Tx >>
-- <SIP/gw114.phono.com-00000014>AGI Script googletts.agi completed, returning 0
-- Executing [inicio@URA:2] WaitExten("SIP/gw114.phono.com-00000014", "30") in new stack
for the most part the script is working perfectly. We seem to have run into a character limit. I can put in 222 characters and then it cuts the rest. I am watching the console output, and I can see the cut there too. Is there somewhere I can increase that?
Hi,
Firstly, thanks for all the effort you put in creating this agi, awesome!
The script runs perfect when called from a dial-plan, however I have an issue. Whenever I put any commas in the text, then the next part of the sentence after comma is not read or recognized by googletts. I am using following to execute the agi.
Works fine:
$agi->exec("AGI","googletts.agi,"Hello my name is Tina!",en");
Text after comma is not recognized:
$agi->exec("AGI","googletts.agi,"Hello, I am Asterisk! I attend all your calls, you will never need anyone else.",en");
Please provide some help in this regards.
Thanks.
Hi, i have asterisk 13.20.0
With the last googletts.so, can't play file (and no format find).
I try with Zoiper (iOS app) and cisco 7965g.
== Using SIP RTP CoS mark 5
> 0x746111b8 -- Strict RTP learning after remote address set to: 192.168.0.108:59128
-- Executing [101@pbx_config:1] Answer("SIP/004-00000000", "") in new stack
> 0x746111b8 -- Strict RTP switching to RTP target address 192.168.0.108:59128 as source
-- Executing [101@pbx_config:2] AGI("SIP/004-00000000", "googletts.agi,"Par Toutatix je parle !",fr") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
-- googletts.agi: Text passed for synthesis: Par Toutatix je parle !
-- googletts.agi: Language: fr, Interrupt keys: , Sample rate: 8000
-- googletts.agi: Speed: 1, Caching: 1, Cache dir: /tmp
-- googletts.agi: URL passed: https://translate.google.com/translate_tts?ie=UTF-8&q=Par%20Toutatix%20je%20parle%20%21&tl=fr&total=1&idx=0&textlen=23&client=tw-ob&tk=172685.318347&prev=input
-- googletts.agi: Found sox version 14 in: /usr/bin/sox, mpg123 in: /usr/bin/mpg123
[May 23 22:54:39] WARNING[25724][C-00000000]: file.c:774 ast_openstream_full: File /tmp/ggl_NUdlQJqD does not exist in any format
-- googletts.agi: Failed to play /tmp/ggl_NUdlQJqD.
Died at /var/lib/asterisk/agi-bin/googletts.agi line 232, <STDIN> line 32.
-- googletts.agi: Cleaning temp files.
-- <SIP/004-00000000>AGI Script googletts.agi completed, returning -1
-- Executing [101@pbx_config:3] Hangup("SIP/004-00000000", "") in new stack
== Spawn extension (pbx_config, 101, 3) exited non-zero on 'SIP/004-00000000'
Before I send a pull request for this, it's probably better to ask how you'd like this to be handled.
AGI scripts shouldn't explicitly answer the line unless told to do so. This includes scripts like this, so that it's possible to send early audio (dialplan does Progress
and then plays back audio).
My usecase, as an example: A line which plays back a "number has been changed" message. It should only answer the line if I did Answer
in the dialplan, at least by default. So for the moment I've simply commented out the whole block which does CHANNEL STATUS ... ANSWER.
Since this script is already in wide use, its current default is already well known. So would it be better to add another optional parameter that can be set to noanswer
as with the standard Playback
application?
Hi Zaf,
Its me again :) hope you doin okay!
Ive run into a problem where I have the followin executed in php agi. Currently I am using get_data to receive the DTMF and execute the condition attached to it. My problem is that the DTMF is not accepted till the complete options are read out by googletts, hence I would like to use the interrupt keys function provided by you to invoke the reading and execute the DTMF. Is there a way to do it in php agi?
If you could plllllllllllllleeeeeeeaaaaseeeee shed some light.
{
$agi->exec("AGI","googletts.agi,\"Some text $variable1\",en,");
$agi->exec("AGI","googletts.agi,\"Some text 2 $variable2\",en");
$agi->exec("AGI","googletts.agi,\"Some text 3 $variable3 \",en");
$agi->exec("AGI","googletts.agi,\"Some text 4 $variable4 \",en");
$agi->exec("AGI","googletts.agi,\"or press zero for the operator\",en");
//grab user input data from history options
$press1 = $agi->get_data('silence/1',50000, 1);
$press1dtmf = $press1['result'];
if ($press1dtmf=="1")
{
$agi->exec("AGI","googletts.agi,\"We are sorry! This feature is currently not available. Your call is now being transferred to our operator.\",en");
$agi->exec('transfer',"SIP/[email protected]:5080");
$agi->hangup();
}
if conditions continued......
Hello zaf ,
Thanks for your effort here ,
can you assist me to found solution for my issue ?
perl /var/lib/asterisk/agi-bin/googletts.agi -l de -t "HalloHallo" -o test.wav
Use of uninitialized value $AGI{"request"} in concatenation (.) or string at /var/lib/asterisk/agi-bin/googletts.agi line 96, line 1.
CHANNEL STATUS
-- : Unexpected result:
GET FULL VARIABLE ${CHANNEL(audionativeformat)}
-- : Unexpected result:
STREAM FILE /tmp/ggl_dSfXLX1G ""
-- : Unexpected result:
-- : Failed to play /tmp/ggl_dSfXLX1G.
NOOP " -- : Failed to play /tmp/ggl_dSfXLX1G."
-- : Unexpected result:
Died at /var/lib/asterisk/agi-bin/googletts.agi line 233, line 5.
Hi,
I have a trouble with this plug-in. I used this script many times before, but now, it no longer works.
I have errors when I try to use it with command line. My errors is :
Use of uninitialized value $AGI{"request"} in concatenation (.) or string at /var/lib/asterisk/agi-bin/googletts.agi line 96, <STDIN> line 1.
CHANNEL STATUS
-- : Unexpected result:
GET FULL VARIABLE ${CHANNEL(audionativeformat)}
-- : Unexpected result:
/usr/bin/sox FAIL tempo: parameter `factor' must be between 0.1 and 100
/usr/bin/sox FAIL tempo: usage: [-q] [-m | -s | -l] factor [segment-ms [search-ms [overlap-ms]]]
-- : /usr/bin/sox failed: 256
My command is :
/var/lib/asterisk/agi-bin/googletts.agi -l fr -r 8000 -f my_text_file.txt -o my_tts_voice_file.wav
I am on Raspbx system (Raspbian with Debian 8). I installed packages needed before.
Thank you for your help.
The output says that /tmp/9c45b949ba1c0594e69d73586c34c386.slin
is being played but I hear no audio.
exten => s,1,Answer()
same => n,agi(googletts.agi,"This is a simple google text to speech test in english.",en)
-- Attempting call on SIP/kazoo/1972XXXXXXX for s@kazoo-test-taryn:1 (Retry 1)
== Using SIP RTP CoS mark 5
-- Called kazoo/1972XXXXXXX
-- SIP/kazoo-0000000a is ringing
-- SIP/kazoo-0000000a is making progress
-- SIP/kazoo-0000000a answered
-- Executing [s@kazoo-test-taryn:1] Answer("SIP/kazoo-0000000a", "") in new stack
-- Executing [s@kazoo-test-taryn:2] AGI("SIP/kazoo-0000000a", "googletts.agi,"This is a simple google text to speech test in english.",en") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
-- <SIP/kazoo-0000000a> Playing '/tmp/9c45b949ba1c0594e69d73586c34c386.slin' (escape_digits=) (sample_offset 0) (language 'en')
-- <SIP/kazoo-0000000a>AGI Script googletts.agi completed, returning 0
-- Auto fallthrough, channel 'SIP/kazoo-0000000a' status is 'UNKNOWN'
root@arsenic2:# file /tmp/9c45b949ba1c0594e69d73586c34c386.slin
/tmp/9c45b949ba1c0594e69d73586c34c386.slin: ERROR: cannot open `/tmp/9c45b949ba1c0594e69d73586c34c386.slin' (No such file or directory)
hi i had googletts working for two years.
my setup is freepbx version 12.0.76.1 with asterisk Ver. 11.16.0
now, even with the updated script it gives me errors.
this is the output if i use googletts.agi
[root@localhost agi-bin]# perl googletts.agi -o hello.wav -l it -t "Hello world"
Use of uninitialized value $AGI{"request"} in concatenation (.) or string at googletts.agi line 95, line 1.
-- : Invalid language setting. Using default.
CHANNEL STATUS
-- : Unexpected result:
GET FULL VARIABLE ${CHANNEL(audionativeformat)}
-- : Unexpected result:
-- : Failed to fetch file.
this one is the one using the googletts-cli.pl which is the file i used before
[root@localhost agi-bin]# ./googletts-cli.pl -o hello.wav -l en -t "Hello world"
Failed to fetch speech data. at ./googletts-cli.pl line 126.
i can manually download the tts file with this command
wget -q -U Mozilla -O output.mp3 "http://translate.google.com/translate_tts?ie=UTF-8&client=t&tl=it&q= hello world"
Hi all,
even if not really applicable in the real world i've found a possible caveat in file caching:
if you call the script twice with the same text but different languages (not very frequent but possible) the same file will be played back.
To avoid this i suggest to add language in cached file names as below:
if ($usecache) {
$filename = md5_hex($line) . "_$lang";
Regards
Gianluca
I would like to allow user dialing number during google tts playing.
Is there any way to make it work like asterisk read command?
Log in Asterisk:
-- <SIP/1000-00000003>AGI Script googletts.agi completed, returning 0
-- Executing [9999@atendimento:19] AGI("SIP/1000-00000003", "googletts.agi,"Para ouvir novamente. Digite 9",pt-BR,any") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
<SIP/1000-00000003>AGI Tx >> agi_request: googletts.agi
<SIP/1000-00000003>AGI Tx >> agi_channel: SIP/1000-00000003
<SIP/1000-00000003>AGI Tx >> agi_language: pt_BR
<SIP/1000-00000003>AGI Tx >> agi_type: SIP
<SIP/1000-00000003>AGI Tx >> agi_uniqueid: 1448549400.3
<SIP/1000-00000003>AGI Tx >> agi_version: 1.8.25.0
<SIP/1000-00000003>AGI Tx >> agi_callerid: 1000
<SIP/1000-00000003>AGI Tx >> agi_calleridname: Atendimento
<SIP/1000-00000003>AGI Tx >> agi_callingpres: 0
<SIP/1000-00000003>AGI Tx >> agi_callingani2: 0
<SIP/1000-00000003>AGI Tx >> agi_callington: 0
<SIP/1000-00000003>AGI Tx >> agi_callingtns: 0
<SIP/1000-00000003>AGI Tx >> agi_dnid: 9999
<SIP/1000-00000003>AGI Tx >> agi_rdnis: unknown
<SIP/1000-00000003>AGI Tx >> agi_context: atendimento
<SIP/1000-00000003>AGI Tx >> agi_extension: 9999
<SIP/1000-00000003>AGI Tx >> agi_priority: 19
<SIP/1000-00000003>AGI Tx >> agi_enhanced: 0.0
<SIP/1000-00000003>AGI Tx >> agi_accountcode: 5
<SIP/1000-00000003>AGI Tx >> agi_threadid: -1254835344
<SIP/1000-00000003>AGI Tx >> agi_arg_1: Para ouvir novamente. Digite 9
<SIP/1000-00000003>AGI Tx >> agi_arg_2: pt-BR
<SIP/1000-00000003>AGI Tx >> agi_arg_3: any
<SIP/1000-00000003>AGI Tx >>
Use of uninitialized value $AGI{"arg_4"} in length at /var/lib/asterisk/agi-bin/googletts.agi line 130, line 24.
<SIP/1000-00000003>AGI Rx << CHANNEL STATUS
<SIP/1000-00000003>AGI Tx >> 200 result=6
-- googletts.agi: Command returned: 200 result=6
<SIP/1000-00000003>AGI Rx << GET FULL VARIABLE ${CHANNEL(audionativeformat)}
<SIP/1000-00000003>AGI Tx >> 200 result=1 (ulaw)
-- googletts.agi: Command returned: 200 result=1 (ulaw)
-- googletts.agi: Text passed for synthesis: Para ouvir novamente. Digite 9.
-- googletts.agi: Language: pt-BR, Interrupt keys: 0123456789#*, Sample rate: 8000
-- googletts.agi: Speed: 1.3, Caching: 1, Cache dir: /googletts_audio
-- googletts.agi: URL passed: https://translate.google.com/translate_tts?ie=UTF-8&q=Para%20ouvir%20novamente.%20Digite%209.&tl=pt-BR&total=1&idx=0&textlen=31&client=t&tk=87295|20611
-- googletts.agi: Failed to fetch file.
-- googletts.agi: Cleaning temp files.
XXXXX_____
Result on command line:
root@sneppbx:~/asterisk-googletts# perl googletts.agi "test" "en"
Use of uninitialized value $AGI{"request"} in concatenation (.) or string at googletts.agi line 96, line 1.
Use of uninitialized value $AGI{"arg_3"} in length at googletts.agi line 125, line 1.
Use of uninitialized value $AGI{"arg_4"} in length at googletts.agi line 130, line 1.
CHANNEL STATUS
-- : Unexpected result:
GET FULL VARIABLE ${CHANNEL(audionativeformat)}
-- : Unexpected result:
-- : Failed to fetch file.
XXXXX_____
Using the command:
perl ./googletts-cli.pl -t "testing googletts" -o testing.wav
The audio file is properly synthesized.
XXXXX_____
System:
Debian Wheezy
Asterisk 1.8.25.0
installed: git sox mpg123 libwww-perl perl libcrypt-ssleay-perl libsox-fmt-mp3 liblwp-protocol-https-perl
Fixed
The script was working smoothly until recently it stopped working. I enabled debug mode and relevant part of /var/log/asterisk/full log file follows:
-- Executing [10012@from-internal:3] AGI("Local/XXX@from-internal-0000000a;1", "googletts.agi,"Sayın Erdem Olcay, 16 20 saatinde XXX işiniz bulunmaktadır.",tr") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
Use of uninitialized value $AGI{"arg_3"} in length at /var/lib/asterisk/agi-bin/googletts.agi line 124, <STDIN> line 23.
Use of uninitialized value $AGI{"arg_4"} in length at /var/lib/asterisk/agi-bin/googletts.agi line 129, <STDIN> line 23.
-- googletts.agi: Command returned: 200 result=6
-- googletts.agi: Command returned: 200 result=1 ((slin))
-- googletts.agi: Text passed for synthesis: Sayın Erdem Olcay, 16 20 saatinde XXX işiniz bulunmaktadır.
-- googletts.agi: Language: tr, Interrupt keys: , Sample rate: 8000
-- googletts.agi: Speed: 1, Caching: 1, Cache dir: /tmp
-- googletts.agi: URL passed: https://translate.google.com/translate_tts?ie=UTF-8&q=Say%C4%B1n%20Erdem%20Olcay%2C%20%C5%9Eahino%C4%9Flu%20Turizm'den%20ar%C4%B1yoruz.%2016%2020%20saatinde%20BOMONT%C4%B0%20%C4%B0MPERYAL%20HOTEL%20i%C5%9Finiz%20bulunmaktad%C4%B1r.&tl=tr&total=1&idx=0&client=t
-- googletts.agi: Failed to fetch file.
-- googletts.agi: Cleaning temp files.
-- <Local/XXX@from-internal-0000000a;1>AGI Script googletts.agi completed, returning 0
When I run below command from Linux shell (with the URL in the log) I can download audio file:
wget -q -U Mozilla -O anons.mp3 "https://translate.google.com/translate_tts?ie=UTF-8&q=Say%C4%B1n%20Erdem%20Olcay%2C%20%C5%9Eahino%C4%9Flu%20Turizm%27den%20ar%C4%B1yoruz.%2016%2020%20saatinde%20BOMONT%C4%B0%20%C4%B0MPERYAL%20HOTEL%20i%C5%9Finiz%20bulunmaktad%C4%B1r.&tl=tr&total=1&idx=0&client=t"
My dialplan is here:
exten => 10012,1,Answer()
exten => 10012,2,AGI(sofor_cevaplandi.php)
exten => 10012,3,AGI(googletts.agi,"Sayın ${isim}, ${saat} saatinde ${aciklama} işiniz bulunmaktadır.",tr)
What do you think might be the cause of the problem?
Not working anymore from 12 oct 2015
Hello, I've download the last version of googletts-cli but I still receive a 403 Forbidden when I try to launch it
It's possible that also with the use of the token Google can block an ip address for over-used of the service?
Running the following code:
exten => *123,1,Answer()
same => n,Set(CurrTimeHours=-1)
same => n,Set(Count=-1)
same => n(loop),Set(Count=$[${Count}+1])
same => n,Set(CurrTimeHours=${Count})
same => n,GoSub(subPolishTime,s,case${CurrTimeHours})
same => n,agi(googletts.agi,"${Count}",en)
same => n,agi(googletts.agi,"${CurrTimeHours}",pl)
same => n,Wait(0.1)
same => n,GotoIf($[${Count}=23]?end:loop)
same => n(end),Hangup(22)
[subPolishTime]
exten => s,1,NoOp(Case ${CurrTimeHours})
same => n(case1),Set(CurrTimeHours=pierwsza)
same => n,Return()
same => n(case2),Set(CurrTimeHours=druga)
same => n,Return()
same => n(case3),Set(CurrTimeHours=trzecia)
same => n,Return()
same => n(case4),Set(currTimeHours=czwarta)
same => n,Return()
same => n(case5),Set(CurrTimeHours=piąta)
same => n,Return()
same => n(case6),Set(CurrTimeHours=szósta)
same => n,Return()
same => n(case7),Set(CurrTimeHours=siódma)
same => n,Return()
same => n(case8),Set(CurrTimeHours=ósma)
same => n,Return()
same => n(case9),Set(CurrTimeHours=dziewiąta)
same => n,Return()
same => n(case10),Set(CurrTimeHours=dziesiąta)
same => n,Return()
same => n(case11),Set(CurrTimeHours=jedenasta)
same => n,Return()
same => n(case12),Set(CurrTimeHours=dwunasta)
same => n,Return()
same => n(case13),Set(CurrTimeHours=trzynasta)
same => n,Return()
same => n(case14),Set(CurrTimeHours=czternasta)
same => n,Return()
same => n(case15),Set(CurrTimeHours=piętnasta)
same => n,Return()
same => n(case16),Set(CurrTimeHours=szesnasta)
same => n,Return()
same => n(case17),Set(CurrTimeHours=siedemnasta)
same => n,Return()
same => n(case18),Set(CurrTimeHours=osiemnasta)
same => n,Return()
same => n(case19),Set(CurrTimeHours=dziewiętnasta)
same => n,Return()
same => n(case20),Set(CurrTimeHours=dwudziesta)
same => n,Return()
same => n(case21),Set(CurrTimeHours=dwudiesta pierwsza)
same => n,Return()
same => n(case22),Set(CurrTimeHours=dwudiesta druga)
same => n,Return()
same => n(case23),Set(CurrTimeHours=dwudiesta trzecia)
same => n,Return()
same => n(case0),Set(CurrTimeHours=dwudziesta czwarta)
same => n,Return()
Results in Google TTS saying the number 0 in English, the numbers 1 to 3 in Polish and numbers 4 to 23 in English again. It should be saying numbers 0 to 23 in English, not a mix of the two.
core show version
Asterisk 11.1.0 built by abuild @ build22 on a x86_64 running Linux on 2012-12-21 23:25:47 UTC
cat /proc/version
Linux version 3.4.11-2.16-default (geeko@buildhost) (gcc version 4.7.1 20120723 [gcc-4_7-branch revision 189773](SUSE Linux) ) #1 SMP Wed Sep 26 17:05:00 UTC 2012 (259fc87)
perl -v
This is perl 5, version 16, subversion 0 (v5.16.0) built for x86_64-linux-thread-multi
As title says, allow the use of Playback() with "noanswer" to stop supervision.
Hey, is it possible to use SSML with googletts.agi?
Thanks in Advance
Hi Zaf
My googletts is working great I have no issue with it. I am using for about for 5 years.
Thanks you for time and great work well done!
Is there a way when you press a digit while the sound playing, to have a timeout, because I want to use the script to capture more than one digits, I am able to store one digit only just looking a way to capture more digit , like the READ() function in asterisk.
Right now the script is running like a waitExten()
This looking for possibilities, if there is any.
Hi,
Using Asterisk 11, I called the following extension:
exten => *100,1,agi(googletts.agi,"This is a speed test, speed 4",en,,4)
same => n,agi(googletts.agi,"This is a speed test, speed 2",en,,2)
same => n,agi(googletts.agi,"This is a speed test, speed 1",en,,1)
same => n,agi(googletts.agi,"This is a speed test, speed 10",en,,10)
same => n,Hangup()
There was no difference in playback speed for any of the iterations. They all sounded exactly the same.
core show version
Asterisk 11.1.0 built by abuild @ build22 on a x86_64 running Linux on 2012-12-21 23:25:47 UTC
cat /proc/version
Linux version 3.4.11-2.16-default (geeko@buildhost) (gcc version 4.7.1 20120723 [gcc-4_7-branch revision 189773](SUSE Linux) ) #1 SMP Wed Sep 26 17:05:00 UTC 2012 (259fc87)
perl -v
This is perl 5, version 16, subversion 0 (v5.16.0) built for x86_64-linux-thread-multi
sox --version
sox: SoX v14.4.0
mpg123 --version
mpg123 1.14.4
Has google stopped answering our calls?
I just moved and as such I've had my asterisk server disconnected for a few weeks. I've got a few extensions using the googletts.agi script and they were working fine before moving. However today when I tried connecting everything up, I don't get any response when I call the extensions using the script.
In the debug log of asterisk I can see the script is run as per usual, I get a
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
And then nothing happens. Eventually it will timeout after a minute or two, returning 0
-- <SIP/phone_srn-00000001>AGI Script googletts.agi completed, returning 0
I'm trying v.0.6 of your script, but the downloaded file from google server is "corrupted".
I've tried commenting this line:
unlink glob "$tmpname*";
Then I can find the downloaded wav in tmp/.
If you want to listen this is the result:
https://www.dropbox.com/s/y9rho2up4iwd0cd/test.wav
If I visit composed url ($url?tl=$lang&q=$line) with browser I can hear the right message.
Do you have an idea on what's happening?
root@arsenic2:# which sox
/usr/bin/sox
root@arsenic2:# which mpg123
/usr/bin/mpg123
-- Executing [s@kazoo-test-taryn:1] Answer("SIP/kazoo-00000004", "") in new stack
-- Executing [s@kazoo-test-taryn:2] AGI("SIP/kazoo-00000004", "googletts.agi,"This is a simple google text to speech test in english.",en") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
-- googletts.agi: sox or mpg123 is missing. Aborting.
Died at /var/lib/asterisk/agi-bin/googletts.agi line 362, <STDIN> line 24.
-- <SIP/kazoo-00000004>AGI Script googletts.agi completed, returning 0
-- Auto fallthrough, channel 'SIP/kazoo-00000004' status is 'UNKNOWN'
[Dec 22 11:10:28] NOTICE[49589]: pbx_spool.c:426 attempt_thread: Call completed to SIP/kazoo/1972XXXXXXX
(!$sox || !$mpg123)
should probably use &&
.
e.g. agi(googletts.agi,"text",[language],[intkey],[speed],[serverkey])
The serverkey
, when provided, is then passed into all API requests as a key=<serverkey>
parameter, according to official Google guide.
Same goes for zaf/asterisk-googletranslate.
Sorry if this is a really dumb question but I've never used perl before and have next to no idea what I'm doing 🙃
When running googletts-cli.pl
from the command line on a FreePBX installation, I receive the below error:
$ /usr/local/sbin/googletts-cli.pl -l en -f speech.txt -r 8000 -o speech.wav
perl: symbol lookup error: /usr/local/lib64/perl5/auto/Compress/Raw/Zlib/Zlib.so: undefined symbol: Perl_Istack_sp_ptr
It was working just a few weeks ago before I updated FreePBX and trying to search for an answer yields a very small number of results on Google, which as far as I can tell only lead to more problems similar to the error message above.
Thanks if you have the time to help me out 😊
Hi,
I'm having some trouble running the googletts.
I got a 'missing filename' error, for both modes (cli and agi), in development snapshots or stable 0.6 versions.
./googletts-cli.pl -l en -t "Hello world" -s 1
/usr/bin/sox: SoX v14.0.0
Failed: missing filename
./googletts-cli.pl: sox failed to process sound file. at ./googletts-cli.pl line 169.
I also tried it with SoX v12.18.1 and got the same error.
Regards,
Rodrigo
ATT has very generous terms for production $99 per year and that gives 1M hits per month free and 1 cent after passing that limit. The sandbox is pretty good also.
https://developer.att.com/pricing
Should not be too hard to do for speech recog and text to speech.
Hi,
Thanks for a great tool. Unfortunately Google is now redirecting to a CAPTCHA page. Let us know if you find a work-around.
Thanks, PLA
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.