Skip to content

Instantly share code, notes, and snippets.

View marks's full-sized avatar

Mark Silverberg marks

View GitHub Profile
events.asterisk.hungup_call do |event|
#code here
end
events.asterisk.hungup_call do |event|
#code here
end
##events.rb
events.asterisk.manager_interface.each do |event|
if event.name.downcase == "newchannel"
launch_new_call_method(event)
end
end
##component.rb
We couldn’t find that file to show.
task :export do
require 'sequel'
require 'fastercsv'
db = Sequel.connect(ENV['DATABASE_URL'])
table_name = ENV['table'].to_sym
table = db[table_name]
fields = table.first.keys
#record in dialplan.rb
thread = Thread.new do
#do stuff
end
thread.join
require 'rubygems'
require 'sinatra'
require 'appengine-apis/logger'
require 'appengine-apis/datastore'
require 'json'
get '/' do
logger.info "Sinatra in your Google Appengine p0wning your JRuby"
"I AM SINATRA! Doing a ditty for you on Google Appengine with JRuby!"
end
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}"
require "socket"
tcp_socket = TCPSocket.new('thehost', 20000)
active_call = true
options = { :choices => '1,2,3,4,5,6,7,8,9,0' }
while active_call == true do
result = ask 'Please enter a command.', options
if result.value == 0
active_call = false
{
"tropo": [
{
"say": [
{
"value": "Please hold while your call is transferred to a customer service agent."
}
]
},
{