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

The output language is not always the one specified #6

Closed coaxial closed 11 years ago

coaxial commented 11 years ago

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

coaxial commented 11 years ago

Right, it seems there was a mixup between the latest version and the one I was using. I thought it was the latest version but it wasn't, maybe I screwed up when pulling the file from your repo.

Tried again with the latest version and it's fine. Sorry about that!