Skip to content

Instantly share code, notes, and snippets.

New Customer X
i am new to cloudvox...i think i will use it for our business
however, i am lost in terms of where to start since i am new to voice related programming
i have been in IT for over 15 years...lots of web stuff with java, but not voice
Cloudvox Support
thanks for stopping by! yeah, most of the docs are on http://help.cloudvox.com/
New Customer X
that's what i want to implement, but not sure where to start
#!/usr/bin/ruby -w
# pretend to be Asterisk 1.4 (or 1.6 in 1.4 compat mode) connecting to
# a Fast AGI server, as if to process an incoming call.
#
# support: http://help.cloudvox.com/
# version: 20100815
#
# usage:
# ./asterisk_agi_test.rb some_nondefault_option=val option2=val2
@cloudvoxcode
cloudvoxcode / adhearsion_outgoing_call.rake
Created June 23, 2010 05:40
place & receive a phone call with Ruby (Adhearsion)
require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
require 'adhearsion'
require 'adhearsion/initializer/asterisk'
require 'drb'
# http://help.cloudvox.com/faqs/getting-started/setup-for-ruby-adhearsion
desc "Make an outgoing phone call to number provided as 'call' (via Cloudvox)"
task :make_outgoing_call do
if ENV['call']
# Outgoing context from Cloudvox Switchboard, under "Outgoing settings (AMI)."
[{"name":"speak","phrase":"Thanks for calling My Company. Press 1 for Bob or 2 for Sally."},
{"name":"getdigits","max":"1","url":"http://my.server/send-caller-somewhere.json"}]
@cloudvoxcode
cloudvoxcode / adhearsion-asterisk-music-on-hold.rb
Created June 15, 2010 20:38
Asterisk music on hold in any conference room
# play music on hold (MP3 or other) as a second conference "participant",
# then disconnect (stop the music) when a real second participant joins.
#
# NOTE: this is a reference example. It hasn't been tested and
# may not run exactly as-is.
class ConferenceDirectory
def initialize
@rooms = {}
end
@cloudvoxcode
cloudvoxcode / ami_listener.rb
Created May 6, 2010 15:54
Asterisk AMI event listener - connect, read, & output
#!/usr/bin/ruby
# connect to Asterisk AMI port, authenticate, and print all AMI event messages
# as they're received.
# more or for Asterisk hosting: http://help.cloudvox.com/
# version: 2010-05-04
require 'socket'
unless ARGV.length == 4
puts 'usage: ruby ./ami_listener.rb hostname port username password'
[{"name":"playback","filename":"thanks-for-calling"},
{"name":"speak","phrase":"Record your update now."},
{"name":"record","filename":"update-from-afar.wav","url":"http://your.server/send-as-email"},
{"name":"speak","phrase":"Submitted. Goodbye."}]
@cloudvoxcode
cloudvoxcode / cell-phone-simulator.rb
Created February 27, 2010 15:11
bring that unique cell phone experience to every phone call
# cell phone simulator with Adhearsion & Cloudvox (http://bit.ly/cvruby)
default {
until caller_finally_given_up?
case (rand*5).to_i
when 0 then play 'intermittent-static'
when 1 then execute 'swift', '"All circuits are busy. Please try your call again later."'
when 2 then hangup
when 3 then execute 'echo'
when 4
sleep until phone_location_changed?
@cloudvoxcode
cloudvoxcode / cloudvox-cdr-export.rb
Created January 9, 2010 23:27
Cloudvox call history export to CSV sample
#!/usr/bin/ruby
require 'rubygems'
require 'httparty'
# basic Cloudvox call history to CSV example
# see http://help.cloudvox.com/faqs/provisioning/call-history
class CallDetailRecords
include HTTParty
format :json
@cloudvoxcode
cloudvoxcode / sound_uploader.rb
Created December 22, 2009 14:43
Cloudvox sound uploader - see help.cloudvox.com
#!/usr/bin/env ruby -w
require 'net/http'
require 'net/https'
begin
require 'net/http/post/multipart'
rescue LoadError
puts "This requires multipart-post."
puts " $ sudo gem install multipart-post"