Skip to content

Instantly share code, notes, and snippets.

require 'httpclient'
Google_Login = 'googlename'
Google_Password = 'password'
PRE_LOGIN_URL = "https://www.google.com/accounts/ServiceLogin"
LOGIN_URL = "https://www.google.com/accounts/ServiceLoginAuth"
VOICE_HOME_URL = "https://www.google.com/voice"
clnt = HTTPClient.new(:agent_name => "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2")
class Hash; alias :+ :merge; end; Home,Mobile,Work,Gizmo = 1,2,3,7
# **** My classes. DO NOT EDIT from here ********************************* #
class VSP
@vsptab = {}
def self.tab; @vsptab; end
attr_reader :fmt, :name, :repeat, :tmo
def initialize *args
attrib = args.pop
args << attrib and attrib = {} unless attrib.class == Hash
@pfx, @fmt, @name = args
@mtelis
mtelis / countCalls.rb
Created July 18, 2010 05:29
Calls in progress counter
# ************************** C O U N T C A L L S ************************
def countCalls acnts, tmo=20
rexp = acnts.values.map {|x| /<sip\:#{Regexp.escape(x)}>/i}
now = Time.now.getutc
counter = Array.new(rexp.length,0)
sys.GetCurrentCalls.each do |call|
user = call.LocalUserField
rexp.each_with_index {|r,i| counter[i] += 1 if user =~ r and (now - call.Inserted.DateTime.ToLocalTime).to_i < (tmo * 60) }
end