Skip to content

Instantly share code, notes, and snippets.

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"
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
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}")
#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
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
#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
##Flowroute sip.conf
register => uname:secret@sip.flowroute.com
[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