Skip to content

Instantly share code, notes, and snippets.

View zlu's full-sized avatar
💭
I may be slow to respond.

Zhao Lu zlu

💭
I may be slow to respond.
View GitHub Profile
#Post script
require 'rubygems'
require 'open-uri'
require 'cgi'
require 'net/http'
require 'mime/types'
#Module sprinkling in Multipart for net/http
module Multipart
transcribe(mp3source, { :transcriptionOutURI => resulturi })
require 'rubygems'
require 'curb'
curl = Curl::Easy.new 'http://sandite.orl.voxeo.net/transcribe'
curl.userpwd = 'username:password'
#voxeon:orlandorox
curl.multipart_form_post = true
curl.http_post Curl::PostField.file('filename', ARGV[0]),
Curl::PostField.content('transcriptionOutFormat', 'json'),
require 'rubygems'
require 'eventmachine'
module DigitCollector
def post_init
puts "-- someone connected to the echo server!"
end
def receive_data data
p ">>>you sent: #{data}"
"**********"
{"query"=>{"results"=>{"result"=>{"value"=>"got some data here"}}, "uri"=>"http://query.yahooapis.com/v1/yql?q=SELECT+*+FROM+yql.storage+WHERE+name+%3D+%27store%3A%2F%2FLymM4H0i9TI0FgdrLZlAE1%27", "diagnostics"=>{"build-version"=>"3130", "publiclyCallable"=>"true", "user-time"=>"34", "service-time"=>"31"}, "count"=>"1", "lang"=>"en-US", "updated"=>Thu Sep 10 11:24:04 UTC 2009, "created"=>Thu Sep 10 11:24:04 UTC 2009}}
"**********"
{"query"=>{"results"=>{"success"=>"Updated store://jQhfGRIErjcVVzd4wOY2nj"}, "uri"=>"http://query.yahooapis.com/v1/yql?q=UPDATE+yql.storage+SET+value%3D%27%7B%22apples%22%3A%22green%22%2C%22bananas%22%3A%22yellow%22%7D%27+WHERE+name+%3D+%27store%3A%2F%2Fk02azLQDF27kArKxszngfx%27", "diagnostics"=>{"build-version"=>"3130", "publiclyCallable"=>"true", "user-time"=>"65", "service-time"=>"64"}, "count"=>"1", "lang"=>"en-US", "updated"=>Thu Sep 10 11:24:04 UTC 2009, "created"=>Thu Sep 10 11:24:04 UTC 2009}}
"**********"
{"query"=>{"results"=>{"result"=>{"value"=>{"bananas"=>"
require 'rubygems'
require 'eventmachine'
module DigitCollector
def post_init
puts "-- someone connected to the echo server!"
end
def receive_data data
p ">>>you sent: #{data}"
# example input: en, es, how are you, 16502437867.
# notice the comma as deliminator
%w(open-uri json).each do |lib| require lib; end
url = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0"
initialText = $currentCall.initialText.split(",")
initialText.each do |elem| elem.strip! end
answer
say 'Bonjour', :voice => 'florence'
result = ask( "Si vous êtes hycinthe, disons hycinthe ou appuyez sur 1, Si vous êtes vanessa, disons vanessa ou appuyez sur 2", { :recognizer => 'fr-fr',
:voice => 'florence',
:repeat => 3,
:choices => "hycinthe (1, hycinthe), vanessa (2, vanessa)" })
log '++++++++++++++++++++++++++++++++++++result.name: ' + result.name
@zlu
zlu / ov-phono
Created December 21, 2010 20:00
on tropo (ruby):
answer()
say("please wait while open voice is transferring your call")
transfer($currentCall.getHeader("x-sbc-numberToDial"))
for phono (rails):
<script>
{
"session": {
"timestamp": "2011-02-02T18:03:34.875Z",
"from": {
"name": nil,
"network": "SMS",
"id": "14153701330",
"channel": "TEXT"
},
"callId": "bbea42c7bd5505e30cb902e8dddef8db",