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
| def queue_status(queue) | |
| if queue == "is" | |
| response = VoIP::Asterisk.manager_interface.send(:send_action, :Queuestatus)[0].headers | |
| stats = Hash.new | |
| stats["Active Calls (waiting for agent)"] = response.values_at("Calls")[0].to_i | |
| stats["% of calls answered within 60 seconds"] = response.values_at("ServicelevelPerf")[0].to_i | |
| stats["Completed Calls (caller spoke with agent)"] = response.values_at("Completed")[0].to_i | |
| stats["Abandoned Calls (caller hung up while waiting)"] = response.values_at("Abandoned")[0].to_i | |
| return stats | |
| 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
| params = Hash.new | |
| if ARGV.empty? | |
| puts "Please supply some arguments..." | |
| else | |
| ARGV.each do |pair| | |
| arr = pair.split("=") | |
| key = arr[0].gsub(/[-]/, '') | |
| value = arr[1] | |
| if params.has_key? 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
| 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 |
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 'eventmachine' | |
| module DigitCollector | |
| def post_init | |
| puts "-- someone connected to the echo server!" | |
| end | |
| def receive_data data | |
| p ">>>you sent: #{data}" |
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 "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 |
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
| get '/' do | |
| case request.env['HTTP_ACCEPT'] | |
| when 'application/xml' | |
| "<3 REST!" | |
| else | |
| haml :index | |
| end | |
| 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
| >> @recordings["skramx_1258124568"]["start_time"].to_s | |
| => "Wednesday" |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <speak> | |
| visit tiny u r l dot com slash y,a,t,n,r,u,2 to view your image. all letters are lower case. Again, that's tiny u r l dot com slash y,a,t,n,r,u,2 | |
| </speak> | |
| </xml> |
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
| <grammar xml:lang="en-us" version="1.0" xmlns="http://www.w3.org/2001/06/grammar" root="ROOT"> | |
| <rule id="ROOT"> | |
| <item repeat="9"> | |
| <ruleref uri="#ONE"/> | |
| </item> | |
| </rule> | |
| <rule id="ONE"> | |
| <item> | |
| <one-of> |
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
| def events() | |
| {'error' => '/error.json', 'hangup' => '/hangup.json'}.each do |event,path| | |
| puts("on :event => #{event}, :next => #{path} ") | |
| end | |
| # on :event => 'error', :next => '/error.json' | |
| # on :event => 'hangup', :next => '/hangup.json' | |
| end |