Tropo 스크립팅을 권하고 싶습니다. 특히 녹음 및 녹음을 수행하는 음성 메일 시스템을 보여주는 their example을 살펴보십시오.
Tropo 녹음을 받아 Amazon S3 버킷에 넣으려는 간단한 Sinatra 앱을 다시 작성하는 동안. 거기에서, 당신은 당신이 원하는대로 그것을 사용할 수 있습니다.
%w(rubygems sinatra yaml logger aws/s3).each do |lib|
require lib
end
# Open configuration file and connect to Amazon
AWS_CONFIG = YAML.load(File.open('config/amazon_s3.yml'))
AWS::S3::Base.establish_connection!(
:access_key_id => AWS_CONFIG['access_key_id'],
:secret_access_key => AWS_CONFIG['secret_access_key']
)
# Exception class with HTTP error codes
class HTTPError < StandardError
attr_reader :code
def initialize(message, code = 500)
super(message)
@code = code
end
end
# Put an uploaded file on S3
def handle_post(params)
params['bucket'] ||= AWS_CONFIG['default_bucket']
raise HTTPError.new("invalid token", 403) if params['token'] != AWS_CONFIG['api_token']
raise HTTPError.new("missing filename", 400) unless params['name']
raise HTTPError.new("bucket #{params['bucket']} is not allowed", 403) unless AWS_CONFIG['allowed_buckets'].include? params['bucket']
AWS::S3::S3Object.store(params['name'],
File.open(params['filename'][:tempfile].path),
params['bucket'])
rescue HTTPError => ex
error(ex.code)
rescue => ex
puts ex
error(500)
end
# Method that receives the file and sends to S3
# /save-to-s3?token=<token>[&bucket=<one-of-allowed-buckets>]&name=filename
post '/save-to-s3' do
handle_post(params)
end
나는 Heroku에서 응용 프로그램을 실행하므로 간단한 config.ru 파일을 추가하여 랙 응용 프로그램으로 인식 할 수 있습니다.
루비를 사용할 필요가 없습니다. Tropo 스크립팅은 Tropo가 Voxeo의 앱 서버를 기반으로하므로 많은 언어를 처리하며 모든 언어로 파일 업로드를 처리 할 수 있습니다.
행운을 비네.
출처
2011-09-23 06:07:07
Sim
내 대답이 허용되지 않는 이유는 무엇입니까? – Sim