zaf / asterisk-googletts

Asterisk AGI script that uses Google's translate text to speech service.
GNU General Public License v2.0
214 stars 125 forks source link

"Failed to fetch file" #21

Closed erdemolcay closed 8 years ago

erdemolcay commented 8 years ago

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?

erdemolcay commented 8 years ago

I edited the script and changed $url from 'https://translate.google.com/translate_tts' to 'http://translate.google.com/translate_tts'. Now it is working.

zaf commented 8 years ago

If ths is the case then you are probably missing some perl lib related to TLS handling.

AlbanWende commented 6 years ago

Same problem. @erdemolcay , your solution works fine!