====== Asterisk Translator ======
* http://zaf.github.io/asterisk-googletts/
* http://zaf.github.io/asterisk-speech-recog/
* http://zaf.github.io/asterisk-googletranslate/
Required packges (CentOS)
yum install perl-Crypt-SSLeay perl-libwww-perl.noarch sox perl-JSON perl-JSON-XS flac perl-IO-Socket-SSL esound-devel libtool-ltdl
wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/mpg123-1.9.1-1.el5.rf.i386.rpm
rpm -i --force mpg123-1.9.1-1.el5.rf.i386.rpm
For Cisco 7970 Authentication, must be set in xml.
[g-speech]
;Speech recognition demo also using googletts.agi for text to speech synthesis:
exten => i,1,Answer()
exten => i,n(start),agi(googletts.agi,"Say something in English, when done press the pound key.",en)
exten => i,n(record),agi(speech-recog.agi,en)
;;exten => i,n,Verbose(1,Script returned: ${confidence} , ${utterance})
;;exten => i,n(playback),agi(googletts.agi,"The text you just said was...",en)
exten => i,n,agi(googletranslate.agi,"${utterance}",pt-BR)
;;exten => i,n,Verbose(1,Translated text: ${gtranslation})
exten => i,n,agi(googletts.agi,"${gtranslation}",pt-BR)
exten => i,n,agi(transcript.agi,"${gtranslation}",pt-BR)
exten => i,n,agi(pushtocisco.agi, 10.1.1.2, "http://10.1.1.1/xmlservices/translator/?lang=pt-BR")
exten => i,n,goto(i,start)
XML service for cisco 7970. Reads transcript file and makes an xml.
';
?>
Live Translation ()
Create the transcript
#!/usr/bin/php
Push translate URL to cisco 7970
#!/usr/bin/php -q
";
$xml = "XML=".urlencode($xml);
$post = "POST /CGI/Execute HTTP/1.0\r\n";
$post .= "Host: $ip\r\n";
$post .= "Authorization: Basic $auth\r\n";
$post .= "Connection: close\r\n";
$post .= "Content-Type: application/x-www-form-urlencoded\r\n";
$post .= "Content-Length: ".strlen($xml)."\r\n\r\n";
$response = '';
$fp = fsockopen ($ip, 80, $errno, $errstr, 30);
if (!$fp) {
//error_log("$errstr ($errno)
\n");
} else {
fputs($fp, $post.$xml);
flush();
while (!feof($fp)) {
$response .= fgets($fp, 128);
flush();
}
}
//error_log($response);
}
$uid = "test";
$pwd = "test";
push2phone($argv[1], $argv[2], $uid, $pwd);