Closed jeetzz closed 10 years ago
At the moment googletts.agi can do 2 things: -Playback the generated sound prompt using the STREAM FILE AGI command. In this case no input is accepted, playback can't be interrupted and nothing is returned by the script. -Playback the generated sound prompt using STREAM FILE with the interrupt key value set. In this case the script accepts digits from the caller as input, interrupts the playback if the input matches the interrupt digit and proceeds the dialplan execution to the extension matching the given digit. (for details check the function playback() in googletts.agi)
I guess that none of the above can match the functionality you are trying to replicate in your code. Googletts.agi will not interrupt the playback and return the received digit in your code, or let your code receive the users input. That's why I have already suggested that you should try to re-implement parts of googletts in your own code so that you can adjust it to your needs. Calling an AGI script from within an AGI script is not very handy.
Hi Zaf, Thanks for your reply. Okay I understand your point... is there a possibility you could share some sort of guide or a tutorial that I could look at before implementing googletts in my php agi code.
Thanks for your help.
As I said the code is there for reading and studying ;) In general you send a get request formed like that: http://translate.google.com/translate_tts?tl=en&q=Hello where 'tl' is the language and 'q' the string you want to synthesize (remember to escape it properly). This will give you back the voice data in mp3 format. The tricky part is that it accepts strings only up to 100 characters long, so if your input string is bigger you have to cut it down accordingly. In googlettts we use this regex: /.{1,99}[.,?!:;]|.{1,99}\s/g to partition the original string to a series of strings no bigger than 100 chars, cutting it down to the closest punctuation mark or space before the 100 char limit so we don't cut words in half. Then we submit each string in a separate request. Another thing to have in mind is that it drops requests that are not coming from web browsers, so make sure your script imitates some desktop browser by setting the user agent header accordingly.
Thanks a lot zaf :100: ....I will have a crack at it. Hopefully it,ll be one without flaws :)
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.
if conditions continued......