This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand( | |
{ | |
name: "rails", | |
takes: {"method": noun_arb_text}, | |
icon: "http://rubyonrails.org/images/rails.png", | |
homepage: "", | |
author: {name: "Zhao Lu", email: "[email protected]"}, | |
license: "MPL,GPL", | |
description: "Search rails documentation", | |
help: "Type a rails class or method", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Flowroute sip.conf | |
register => uname:[email protected] | |
[flowroute] ;keep this lowercase, do not change format | |
type=friend | |
secret= | |
username= | |
host=sip.flowroute.com | |
dtmfmode=rfc2833 | |
context=flowroute ;change to 'ext-did' or 'from-trunk' for asterisk@home |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Method to create files themselves, takes the texts, creates the file and returns the filename | |
def surveys_create_file(text) | |
case engine | |
#Cepstral speech engine, see http://www.cepstral.com, as it requires a license | |
when "cepstral" | |
filename = '/var/lib/asterisk/sounds' + new_guid + ".wav" | |
system("swift -o #{filename} -p audio/channels=1,audio/sampling-rate=8000 '#{text}'") | |
#Festival OSS speech engine | |
#on CentOS v5.0+ simply do a yum install festival |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installing AMR libraries: | |
Grab the AMR Codec Libraries (The FFmpeg documentation has a section about installing AMR): | |
e.g. amrnb-6.1.0.4.tar.bz2 and amrwb-7.0.0.1.tar.bz2 | |
Decompress sources: | |
bunzip2 amrnb-6.1.0.4.tar.bz2 | |
tar xvf amrnb-6.1.0.4.tar | |
Change directory: | |
cd amrnb-6.1.0.4 | |
Configure and install: | |
./configure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Sinatra server | |
require 'rubygems' | |
require 'sinatra' | |
post '/upload' do | |
filename = "./uploaded/" + Time.now.to_i.to_s + ".gsm" | |
FileUtils.mv params[:data][:tempfile].path, filename | |
"Received #{File.size filename} bytes and saved as #{filename} for user #{params[:user_id]}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'open-uri' | |
require 'curb' | |
api_access_key = "xxx" | |
url = "http://voicemail.alpha.orange-api.net/voicemail/updateAnnouncement.xml" | |
c = Curl::Easy.new url | |
c.multipart_form_post = true | |
c.http_post Curl::PostField.file('sound', './tt-monkeys.wav'), Curl::PostField.content('id', "#{api_access_key}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installing AMR libraries: | |
Grab the AMR Codec Libraries (The FFmpeg documentation has a section about installing AMR): | |
e.g. amrnb-6.1.0.4.tar.bz2 and amrwb-7.0.0.1.tar.bz2 | |
Decompress sources: | |
bunzip2 amrnb-6.1.0.4.tar.bz2 | |
tar xvf amrnb-6.1.0.4.tar | |
Change directory: | |
cd amrnb-6.1.0.4 | |
Configure and install: | |
./configure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
answer | |
wait 1000 | |
result = record("Please leave your message at the beep",{'beep'=>true, :silenceTimeout=> 8, :maxTime=>30,:timeout=>5.03456789}) | |
log "recorded " + result.recordURI.to_s | |
require 'open-uri' | |
uri = URI.encode(result.recordURI) | |
opened = open(uri, :http_basic_authentication => ["", ""]) | |
read = opened.read | |
log "downloaded" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#tropo example, playing twitter friends timeline | |
require 'json' | |
require 'net/http' | |
answer | |
say 'hello, welcome to your twitter status' | |
options = { | |
:choices => 'asha(1, asha), georges(2, georges), jason(3, jason), mark(4, mark), zhao(5, zhao)', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
answer | |
wait 1000 | |
result = record("Please leave your message at the beep",{'beep'=>true, :silenceTimeout=> 8, :maxTime=>30,:timeout=>5.03456789}) | |
log "recorded " + result.recordURI.to_s | |
require 'open-uri' | |
uri = URI.encode(result.recordURI) | |
opened = open(uri, :http_basic_authentication => ["", ""]) | |
read = opened.read | |
log "downloaded" |
OlderNewer