source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
tasks/reversion.rake
Ruby
mit
49
master
208
desc "update version.rb" task :reversion do File.open("lib/fsr/version.rb", 'w+') do |file| file.puts("module FSR") file.puts(' VERSION = %p' % GEMSPEC.version.to_s) file.puts('end') end end
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
tasks/release.rake
Ruby
mit
49
master
1,297
namespace :release do task :all => [:release_github, :release_rubyforge] desc 'Display instructions to release on github' task :github => [:reversion, :gemspec] do name, version = GEMSPEC.name, GEMSPEC.version puts <<INSTRUCTIONS First add the relevant files: git add AUTHORS MANIFEST CHANGELOG #{name}....
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
tasks/copyright.rake
Ruby
mit
49
master
650
desc "add copyright to all .rb files in the distribution" task :copyright do ignore = File.readlines('License.txt'). select{|line| line.strip!; File.exist?(line)}. map{|file| File.expand_path(file)} puts "adding copyright to files that don't have it currently" puts PROJECT_COPYRIGHT puts Dir['{lib,t...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
tasks/authors.rake
Ruby
mit
49
master
1,086
# Once git has a fix for the glibc in handling .mailmap and another fix for # allowing empty mail address to be mapped in .mailmap we won't have to handle # them manually. desc 'Update AUTHORS' task :authors do authors = Hash.new(0) `git shortlog -nse`.scan(/(\d+)\s(.+)\s<(.*)>$/) do |count, name, email| case...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
tasks/setup.rake
Ruby
mit
49
master
366
desc 'install all possible dependencies' task :setup => :gem_installer do GemInstaller.new do # core gem 'eventmachine' # doc gem 'yard' setup end end desc 'install all possible dependencies' task :setup_spec => :setup do GemInstaller.new do # spec gem 'bacon' gem 'tmm1-em-spec...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
tasks/changelog.rake
Ruby
mit
49
master
620
require 'time' desc 'update changelog' task :changelog do File.open('CHANGELOG', 'w+') do |changelog| `git log -z --abbrev-commit`.split("\0").each do |commit| next if commit =~ /^Merge: \d*/ ref, author, time, _, title, _, message = commit.split("\n", 7) ref = ref[/commit ([0-9a-f]+)/, 1] ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
examples/play_and_get_digits.rb
Ruby
mit
49
master
810
#!/usr/bin/env ruby require 'fsr' require "fsr/listener/outbound" require 'securerandom' class PlayAndGetDigitsDemo < FSR::Listener::Outbound SWEET_WAV = "/usr/local/freeswitch/sounds/music/8000/sweet.wav" NOT_WAV = "/usr/local/freeswitch/sounds/music/8000/not.wav" def session_initiated exten = @session.he...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
examples/outbound_event_socket.rb
Ruby
mit
49
master
1,118
#!/usr/bin/env ruby require File.join(File.dirname(__FILE__), "..", 'lib', 'fsr') require "fsr/listener/outbound" $stdout.flush class OutboundDemo < FSR::Listener::Outbound def session_initiated exten = @session.headers[:caller_caller_id_number] FSR::Log.info "*** Answering incoming call from #{exten}" ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
examples/inbound_event_socket.rb
Ruby
mit
49
master
352
#!/usr/bin/env ruby require 'pp' require File.join(File.dirname(__FILE__), "..", 'lib', 'fsr') $stdout.flush require "fsr/listener/inbound" class IesDemo < FSR::Listener::Inbound def on_event(event) pp event.headers pp event.content[:event_name].to_s end end FSR.start_ies!(IesDemo, :host => "pip", :po...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
examples/inbound_socket_events.rb
Ruby
mit
49
master
859
#!/usr/bin/env ruby require 'pp' require File.join(File.dirname(__FILE__), "..", 'lib', 'fsr') $stdout.flush require "fsr/listener/inbound" # EXAMPLE 1 # This adds a hook on CHANNEL_CREATE events. You can also create a method to handle the event you're after. See the next example FSL::Inbound.add_event_hook(:CHANNEL...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr.rb
Ruby
mit
49
master
3,836
require 'socket' require 'pathname' require 'pp' # Author:: TJ Vanderpoel (mailto:bougy.man@gmail.com) # Copyright:: Copyright (c) 2009 The Rubyists (Jayson Vaughn, TJ Vanderpoel, Michael Fellinger, Kevin Berry) # License:: Distributes under the terms of the MIT License http://www.opensource.org/licenses/mit-lice...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/rack/middleware.rb
Ruby
mit
49
master
2,357
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com> # Distributed under the terms of the MIT license. # The full text can be found in the LICENSE file included with this software # module FSR module Rack class Middleware def initialize(app) @app = app end ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/file_methods.rb
Ruby
mit
49
master
306
module FSR module App module FileMethods def test_files *files files.each do |file| next unless file =~ /^\// next if File.open(file){|io| io.stat.file? } raise(ArgumentError, "No such file - #{file}") end true end end end end
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd.rb
Ruby
mit
49
master
2,154
module FSR module Cmd class Command DEFAULT_OPTIONS = { :origination_caller_id_name => FSR::DEFAULT_CALLER_ID_NAME, :origination_caller_id_number => FSR::DEFAULT_CALLER_ID_NUMBER, :originate_timeout => 30, :ignore_early_media => true } protected def default...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/event_socket.rb
Ruby
mit
49
master
961
module FSR class EventSocket attr_reader :socket def initialize(socket) @socket = socket end # Send a command and return response def say(cmd) @socket.send("#{cmd}\n\n",0) response end # Send a command, do not return response def <<(cmd) @socket.send("#{cmd}\...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app.rb
Ruby
mit
49
master
1,667
module FSR module App class Application def to_s sendmsg end def app_name self.class.name.split("::").last.downcase end # This method builds the API command to send to freeswitch def raw "%s(%s)" % [app_name, arguments.join(" ")] end def s...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/command_socket.rb
Ruby
mit
49
master
762
require "fsr/event_socket" require "fsr/cmd" module FSR class CommandSocket < EventSocket include Cmd def initialize(args = {}) @server = args[:server] || "127.0.0.1" @port = args[:port] || "8021" @auth = args[:auth] || "ClueCon" @socket = TCPSocket.new(@server, @port) super(@so...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/fake_socket.rb
Ruby
mit
49
master
1,126
## Fake socket used for mock testing ## # require 'stringio' module FSR class FakeSocket def initialize(remote_host, remote_port) @remote_host, @remote_port = remote_host, remote_port @input = StringIO.new('') @buffer = [] end def hostname 'localhost' end def address ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/database/call_limit.rb
Ruby
mit
49
master
490
require "fsr/database" module FSR module Database module CallLimit DB = Sequel.connect("sqlite:///" + File.join(FSR::FS_DB_PATH, "call_limit.db")) class LimitData < Sequel::Model end LimitData.set_dataset :limit_data class DbData < Sequel::Model end DbData.set_dataset :d...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/database/core.rb
Ruby
mit
49
master
595
require "fsr/database" # This module maps to the Free Switch core.db database # # TODO Separate these models into their own subdirectories module FSR module Database module Core DB = Sequel.connect("sqlite://" + File.join(FSR::FS_DB_PATH, "core.db")) class Complete < Sequel::Model end Com...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/listener/outbound.rb
Ruby
mit
49
master
7,664
require 'rubygems' require 'eventmachine' require 'fsr/listener' require 'fsr/listener/header_and_content_response' module FSR load_all_applications module Listener class Outbound < EventMachine::Protocols::HeaderAndContentProtocol attr_reader :session # Include FSR::App to get all the application...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/listener/inbound.rb
Ruby
mit
49
master
6,912
require 'rubygems' require 'eventmachine' require 'fsr/listener' require 'fsr/listener/header_and_content_response.rb' module FSR module Listener class Inbound < EventMachine::Protocols::HeaderAndContentProtocol attr_reader :auth, :hooks, :server, :port, :subscribed_events, :subscribed_sub_events HO...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/listener/header_and_content_response.rb
Ruby
mit
49
master
488
require 'fsr/listener' module FSR module Listener class HeaderAndContentResponse attr_reader :headers, :content def initialize(args = {}) @headers = args[:headers] @content = args[:content] strip_newlines end def strip_newlines @content.each {|k,v| v.ch...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/listener/mock.rb
Ruby
mit
49
master
379
module FSR module Listener # This module is intended to be used with em-spec module Mock def send_data(data) sent_data << data end def sent_data @sent_data ||= [] end def receive_reply(reply) replies << reply end def repli...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/listener/inbound/event.rb
Ruby
mit
49
master
908
require 'fsr/listener/inbound' module FSR module Listener module Inbound class Event def self.from(data) instance = new capture = header = {} body = {} data.each_line do |line| line.strip! case line when '' ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/model/call.rb
Ruby
mit
49
master
284
require_relative '../ostruct' module FSR module Model class Call < OpenStruct def initialize(fields, *data) super(Hash[fields.zip(data)]) end def fields raise NotImplementedError, "This class is now an OpenStruct" end end end end
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/model/queue.rb
Ruby
mit
49
master
285
require_relative '../ostruct' module FSR module Model class Queue < OpenStruct def initialize(fields, *data) super(Hash[fields.zip(data)]) end def fields raise NotImplementedError, "This class is now an OpenStruct" end end end end
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/model/agent.rb
Ruby
mit
49
master
381
require_relative '../ostruct' module FSR module Model class Agent < OpenStruct attr_accessor :extension, :full_name def initialize(fields, *data) super(Hash[fields.zip(data)]) @extension, @full_name = name.split("-", 2) end def fields raise NotImplementedError, "T...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/model/enum.rb
Ruby
mit
49
master
640
module FSR module Model class Enum attr_reader :offered_routes, :supported_routes, :order, :pref, :service, :route def initialize(offered_routes, supported_routes, order, pref, service, route) ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/model/channel.rb
Ruby
mit
49
master
287
require_relative '../ostruct' module FSR module Model class Channel < OpenStruct def initialize(fields, *data) super(Hash[fields.zip(data)]) end def fields raise NotImplementedError, "This class is now an OpenStruct" end end end end
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/model/tier.rb
Ruby
mit
49
master
285
require_relative '../ostruct' module FSR module Model class Tier < OpenStruct def initialize(fields, *data) super(Hash[fields.zip(data)]) end def fields raise NotImplementedError, "This class is now an OpenStruct" end end end end
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/originate.rb
Ruby
mit
49
master
2,747
require "fsr/cmd" module FSR module Cmd class Originate < Command attr_accessor :target, :endpoint attr_reader :fs_socket, :target_options def initialize(fs_socket = nil, args = {}) # Using an argument hash may not be the the best way to go here, but as long as we're doing # so ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/channels.rb
Ruby
mit
49
master
1,331
require "fsr/app" module FSR module Cmd class Channels < Command include Enumerable def each(&block) @channels ||= run if @channels @channels.each { |call| yield call } end end def initialize(fs_socket = nil, distinct = true) @distinct = distinct...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/conference.rb
Ruby
mit
49
master
2,295
require "fsr/cmd" module FSR module Cmd class Conference < Command attr_reader :fs_socket, :conference_name, :profile, :pin, :flags, :action, :target, :target_options, :digits def initialize(fs_socket = nil, args = {}) raise(ArgumentError, "args (Passed: <<<#{args}>>>) must be a hash") unless ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/fsctl.rb
Ruby
mit
49
master
1,049
# A lot of methods are missing here. The only one implemented is max_sessions # The max_sessions getter currently returns the raw result but could instead return an Integer require "fsr/app" module FSR module Cmd class Fsctl < Command attr_reader :command def initialize(fs_socket = nil) @fs_...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/sofia.rb
Ruby
mit
49
master
1,034
require "fsr/app" module FSR module Cmd class Sofia < Command def initialize(fs_socket = nil) @fs_socket = fs_socket # FSR::CommandSocket obj end # sofia status def status(args = {}) require "fsr/cmd/sofia/status" # Require sofia/status Status.new(@fs_socket, args)...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/enum.rb
Ruby
mit
49
master
1,212
require "fsr/app" module FSR module Cmd class Enum < Command attr_reader :ph_nbr def initialize(fs_socket = nil, phone_number = nil) @fs_socket = fs_socket # FSR::CommandSocket obj @ph_nbr = phone_number # phone number to look up, up to 15 digits end # Send the command to...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/sofia_contact.rb
Ruby
mit
49
master
988
# A lot of methods are missing here. The only one implemented is max_sessions # The max_sessions getter currently returns the raw result but could instead return an Integer require "fsr/app" module FSR module Cmd class SofiaContact < Command attr_reader :contact def initialize(fs_socket = nil, conta...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/uuid_dump.rb
Ruby
mit
49
master
723
require "fsr/app" module FSR module Cmd class UuidDump < Command attr_reader :uuid def initialize(fs_socket = nil, unique_id = nil) @fs_socket = fs_socket # FSR::CommandSocket obj @uuid = unique_id # Freeswitch Unique ID to dump end # Send the command to the event socket,...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/calls.rb
Ruby
mit
49
master
1,207
require "fsr/app" module FSR module Cmd class Calls < Command include Enumerable def each(&block) @calls ||= run if @calls @calls.each { |call| yield call } end end def initialize(fs_socket = nil) @fs_socket = fs_socket # FSR::CommandSocket obj ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/sched_transfer.rb
Ruby
mit
49
master
1,012
require "fsr/app" module FSR module Cmd class SchedTransfer < Command DEFAULTS = {when: 1, context: "default", dialplan: 'xml'} def initialize(fs_socket = nil, args = {}) @fs_socket = fs_socket # FSR::CommandSocket obj args = DEFAULTS.merge(args) @when, @uuid, @to, @context, @d...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/sched_hangup.rb
Ruby
mit
49
master
866
require "fsr/app" module FSR module Cmd class SchedHangup < Command DEFAULTS = {when: 1, cause: "UNKNOWN"} def initialize(fs_socket = nil, args = {}) @fs_socket = fs_socket # FSR::CommandSocket obj args = DEFAULTS.merge(args) @when, @uuid, @cause = args.values_at(:when, :uuid, ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/uuid_send_dtmf.rb
Ruby
mit
49
master
897
require "fsr/cmd" require "fsr/utils/dtmf" module FSR module Cmd class UuidSendDtmf < Command def initialize(fs_socket = nil, args = {}) @fs_socket = fs_socket # FSR::CommandSocket obj @uuid, dtmf = args.values_at(:uuid, :dtmf) raise(ArgumentError, "No uuid given") unless @uuid ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/uuid_transfer.rb
Ruby
mit
49
master
1,049
require "fsr/app" module FSR module Cmd class UuidTransfer < Command DEFAULTS = {both: false, context: "default", dialplan: 'xml'} def initialize(fs_socket = nil, args = {}) @fs_socket = fs_socket # FSR::CommandSocket obj args = DEFAULTS.merge(args) both, @uuid, @to, @context, ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/status.rb
Ruby
mit
49
master
607
require "fsr/app" module FSR module Cmd class Status < Command def initialize(fs_socket = nil) @fs_socket = fs_socket # FSR::CommandSocket obj end # Send the command to the event socket, using bgapi by default. def run(api_method = :api) orig_command = "%s %s" % [api_meth...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/call_center.rb
Ruby
mit
49
master
4,297
require "fsr/app" module FSR module Cmd class CallCenter < Command attr_accessor :cmd def initialize(fs_socket = nil, config_type = :agent) @fs_socket = fs_socket # FSR::CommandSocket obj @config_type = config_type @last_repsonse = nil @cmd = [] end def lis...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/sofia/status.rb
Ruby
mit
49
master
1,240
require "fsr/app" module FSR module Cmd class Sofia class Status < Command attr_reader :fs_socket def initialize(fs_socket = nil, args = {}) @fs_socket = fs_socket # FSR::CommandSocket object @status = args[:status] # Status type; profile or gateway @name = a...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/cmd/sofia/profile.rb
Ruby
mit
49
master
2,686
require "fsr/app" module FSR module Cmd class Sofia class Profile < Command attr_reader :options attr_accessor :fs_socket, :command_string, :name, :action VALID_ACTIONS = [:start, :stop, :restart, :rescan] def initialize(fs_socket = nil, options = nil) @fs_socket ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/utils/dtmf.rb
Ruby
mit
49
master
437
module FSR module Utils module DTMF MAP = Hash[ [%w{a b c}, %w{d e f}, %w{g h i}, %w{j k l}, %w{m n o}, %w{p q r s}, %w{t u v}, %w{w x y z} ].zip((2 .. 9).to_a) ] def self.from_string(dtmf) dtmf.each_char.ma...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/speak.rb
Ruby
mit
49
master
583
require "fsr/app" module FSR module App class Speak < Application attr_reader :message def initialize(message, opts = {}) # wav file you wish to play, full path @message = message @voice = opts[:voice] || "slt" @engine = opts[:engine] || "flite" end def a...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/read.rb
Ruby
mit
49
master
1,017
require "fsr/app" module FSR # http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_read module App class Read < Application attr_reader :chan_var def initialize(sound_file, min = 0, max = 10, chan_var = "fsr_read_dtmf", timeout = 10000, terminators = ["#"]) @sound_file, @min, @max, @chan_...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/answer.rb
Ruby
mit
49
master
325
require "fsr/app" module FSR module App class Answer < Application # Answer a call def initialize end def arguments [] end def sendmsg "call-command: execute\nexecute-app-name: %s\n\n" % [app_name] end end register(:answer, Answer) end ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/hangup.rb
Ruby
mit
49
master
301
require "fsr/app" module FSR module App # http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_hangup class Hangup < Application def initialize(cause = nil) @cause = cause end def arguments @cause end end register(:hangup, Hangup) end end
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/limit.rb
Ruby
mit
49
master
354
require "fsr/app" module FSR module App class Limit < Application def initialize(id = nil, realm = "$${domain}", limit = 5) @realm, @id, @limit = realm, id, limit raise "Must supply a valid id" if @id.nil? end def arguments [@realm, @id, @limit] end end ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/callcenter.rb
Ruby
mit
49
master
426
require "fsr/app" module FSR module App class Callcenter < Application attr_reader :queue def initialize(queue) @queue = queue end def arguments [queue] end def sendmsg "call-command: execute\nexecute-app-name: %s\nexecute-app-arg: %s\nevent-lock:true\...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/ring_ready.rb
Ruby
mit
49
master
389
require "fsr/app" module FSR module App class RingReady < Application # RingReady a call def initialize end def arguments [] end def sendmsg "call-command: execute\nexecute-app-name: %s\n\n" % [app_name] end def app_name 'ring_ready'...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/playback.rb
Ruby
mit
49
master
561
require "fsr/app" require 'fsr/file_methods' module FSR module App class Playback < Application include ::FSR::App::FileMethods attr_reader :wavfile def initialize(wavfile) # wav file you wish to play, full path test_files wavfile @wavfile = wavfile end de...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/fs_sleep.rb
Ruby
mit
49
master
465
require "fsr/app" module FSR module App class FSSleep < Application attr_reader :milliseconds def initialize(milliseconds) # milliseconds to sleep @milliseconds = milliseconds end def arguments [@milliseconds] end def sendmsg "call-command: ex...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/conference.rb
Ruby
mit
49
master
692
require "fsr/app" module FSR module App class Conference < Application attr_reader :target, :profile def initialize(conference_name, conference_profile = nil) # These are options that will precede the target address @target = conference_name @profile = conference_profile || "u...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/play_and_get_digits.rb
Ruby
mit
49
master
2,547
require "fsr/app" require 'fsr/file_methods' module FSR #http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_play_and_get_digits module App class PlayAndGetDigits < Application include ::FSR::App::FileMethods attr_reader :chan_var DEFAULT_ARGS = {:min => 0, :max => 10, :tries => 3, :timeou...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/uuid_dump.rb
Ruby
mit
49
master
472
require "fsr/app" module FSR #http://wiki.freeswitch.org/wiki/Mod_commands#uuid_dump module App class UuidDump < Application def initialize(uuid) @uuid = uuid # Unique channel ID end def arguments [@uuid] end def sendmsg "call-command: execute\nexecute-app...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/set.rb
Ruby
mit
49
master
475
require "fsr/app" module FSR module App # http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_set class Set < Application def initialize(key, value) @key = key @value = value end def arguments [@key, @value] end def sendmsg "call-command: execut...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/fs_break.rb
Ruby
mit
49
master
291
require "fsr/app" module FSR module App class FSBreak < Application def initialize end def arguments [] end def sendmsg "call-command: execute\nexecute-app-name: break\n\n" end end register(:fs_break, FSBreak) end end
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/transfer.rb
Ruby
mit
49
master
616
require "fsr/app" module FSR module App class Transfer < Application attr_reader :destination_number, :dialplan, :context def initialize(destination_number, dialplan = nil, context = nil) @destination_number = destination_number @dialplan = dialplan @context = context en...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/bridge.rb
Ruby
mit
49
master
707
require "fsr/app" module FSR module App class Bridge < Application attr_reader :options def initialize(*params) @options = params.last.is_a?(Hash) ? params.pop : {} @sequential = @options.delete(:sequential) @targets = params end def arguments delimeter = ...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/uuid_setvar.rb
Ruby
mit
49
master
922
require "fsr/app" module FSR #http://wiki.freeswitch.org/wiki/Mod_commands#uuid_setvar module App class UuidSetVar < Application attr_reader :var, :uuid, :assignment def initialize(uuid, var, assignment) @uuid = uuid # Unique channel ID @var = var # Channel variable you wish to 'set...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/pre_answer.rb
Ruby
mit
49
master
389
require "fsr/app" module FSR module App class PreAnswer < Application # PreAnswer a call def initialize end def arguments [] end def sendmsg "call-command: execute\nexecute-app-name: %s\n\n" % [app_name] end def app_name 'pre_answer'...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/uuid_getvar.rb
Ruby
mit
49
master
863
require "fsr/app" module FSR #http://wiki.freeswitch.org/wiki/Mod_commands#uuid_setvar module App class UuidGetVar < Application attr_reader :var, :uuid def initialize(uuid, var) @uuid = uuid # Unique channel ID @var = var # Channel variable you wish to 'set' end def ar...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/execute_app.rb
Ruby
mit
49
master
331
require "fsr/app" module FSR module App # http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_log class ExecuteApp < Application attr_reader :app_name, :arguments def initialize(app, *args) @app_name = app @arguments = args end end register(:execute_app, ExecuteApp)...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/bind_meta_app.rb
Ruby
mit
49
master
609
require "fsr/app" module FSR module App class BindMetaApp < Application attr_reader :options def initialize(args) @options = args end # It would be better to fix App#app_name to transform # CamelCase to snake_case, but that'll be later. def app_name "bind_meta...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/fifo.rb
Ruby
mit
49
master
877
require "fsr/app" module FSR module App class Fifo < Application attr_accessor :name, :direction attr_reader :options def self.<<(name) new(name) end def self.>>(name) new(name, "out", :wait => true) end def initialize(name, direction = nil, options = n...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/valet_park.rb
Ruby
mit
49
master
1,168
require "fsr/app" module FSR module App class ValetPark < Application attr_reader :valet_lot, :stall_number, :action, :range, :timeout, :prompt def initialize(valet_lot, args = {}) @valet_lot = valet_lot @stall_number, @action, @range, @timeout, @prompt = args.values_at(:stall_number,...
github
bougyman/freeswitcher
https://github.com/bougyman/freeswitcher
lib/fsr/app/log.rb
Ruby
mit
49
master
520
require "fsr/app" module FSR module App # http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_log class Log < Application attr_reader :level, :text def initialize(level = 1, text = "") @level = level @text = text end def arguments [@level, @text] end ...
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
Gemfile
Ruby
mit
49
master
232
source "https://rubygems.org" # Specify your gem's dependencies in triangle.gemspec gemspec group :development, :test do gem 'rake', '< 14.0' gem 'rspec' end gem "delaunator", "~> 0.1.0" gem "gradient" gem "scanf", "~> 1.0"
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
triangle_pattern.gemspec
Ruby
mit
49
master
1,378
# frozen_string_literal: true require_relative 'lib/triangle_pattern/version' Gem::Specification.new do |spec| spec.name = 'triangle_pattern' spec.version = TrianglePattern::VERSION spec.platform = Gem::Platform::RUBY spec.authors = ['Wolfgang Wohanka'] spec.email = ['wolfg...
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
Rakefile
Ruby
mit
49
master
1,005
require "bundler/gem_tasks" require "rspec/core/rake_task" module TempFixForRakeLastComment def last_comment last_description end end Rake::Application.send :include, TempFixForRakeLastComment RSpec::Core::RakeTask.new(:spec) task :default => :spec unless ENV.key?('CI') require 'triangle_pattern/triangle_t...
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
lib/triangle_pattern.rb
Ruby
mit
49
master
514
require 'base64' require 'triangle_pattern/version' require 'triangle_pattern/pattern' require 'triangle_pattern/grid' require 'triangle_pattern/svg_image' require 'delaunator/triangulator' require 'gradient' module TrianglePattern def self.generate(width: 900, height: 500, cell_size: 75, variance: 0.75, seed: 135, ...
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
lib/triangle_pattern/pattern.rb
Ruby
mit
49
master
2,793
module TrianglePattern class Pattern def initialize(width, height, cell_size, variance, seed, colors, svg = TrianglePattern::SvgImage.new) @svg = svg @width = width @height = height @points = TrianglePattern::Grid.new(@width, @height, cell_size, variance, seed).generate_grid d = D...
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
lib/triangle_pattern/grid.rb
Ruby
mit
49
master
1,150
module TrianglePattern class Grid def initialize(width, height, cell_size, variance, seed) @width = width @height = height @cell_size = cell_size @variance = variance @seed = seed @calc_variance = cell_size * variance / 2.to_f cells_x = ((@width + 4 * @cell_size) / @cell...
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
lib/triangle_pattern/svg_image.rb
Ruby
mit
49
master
1,452
module TrianglePattern class SvgImage include Comparable private attr_reader :svg_string public attr_reader :height, :width def initialize @width = 100 @height = 100 @svg_string = '' end def width=(width) @width = width.floor end def heig...
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
lib/triangle_pattern/triangle_task.rb
Ruby
mit
49
master
1,143
require 'triangle_pattern' require 'triangle_pattern/rake_task' module TrianglePattern class TriangleTask < RakeTask attr_reader :data def initialize(opts = {}) super raise ArgumentError, :data if @options[:data].nil? @data = @options[:data] end def run_task(_verbose) ...
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
lib/triangle_pattern/rake_task.rb
Ruby
mit
49
master
1,732
require 'rake' require 'rake/tasklib' require 'logger' module TrianglePattern class RakeTask < ::Rake::TaskLib include ::Rake::DSL if defined?(::Rake::DSL) attr_reader :name attr_reader :description attr_reader :verbose private attr_reader :task_arguments, :task_block, :logger, :working_...
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
spec/spec_helper.rb
Ruby
mit
49
master
305
require "bundler/setup" require "triangle_pattern" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" config.disable_monkey_patching! config.expect_with :rspec do |c| c.syntax = :expect end end
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
spec/svg_spec.rb
Ruby
mit
49
master
248
require 'spec_helper' RSpec.describe TrianglePattern::SvgImage do context '#<=>' do it 'is comparable' do svg1 = TrianglePattern::SvgImage.new svg2 = TrianglePattern::SvgImage.new expect(svg1).to eq svg2 end end end
github
hendrixfan/triangle
https://github.com/hendrixfan/triangle
spec/triangle_spec.rb
Ruby
mit
49
master
401
RSpec.describe TrianglePattern do let(:pattern) { TrianglePattern.generate(seed: 100) } describe '.generate' do context 'same seed returns same output' do let(:other_pattern) { TrianglePattern.generate(seed: 100) } it { expect(pattern.to_svg).to eq other_pattern.to_svg } end end it "has a...
github
keygen-sh/temporary_tables
https://github.com/keygen-sh/temporary_tables
temporary_tables.gemspec
Ruby
mit
49
master
908
# frozen_string_literal: true require_relative 'lib/temporary_tables/version' Gem::Specification.new do |spec| spec.name = 'temporary_tables' spec.version = TemporaryTables::VERSION spec.authors = ['Zeke Gabrielse'] spec.email = ['oss@keygen.sh'] spec.summary = 'Create temporary tab...
github
keygen-sh/temporary_tables
https://github.com/keygen-sh/temporary_tables
lib/temporary_tables/methods.rb
Ruby
mit
49
master
1,744
# frozen_string_literal: true module TemporaryTables module Methods extend ActiveSupport::Concern class_methods do def temporary_table(name, ...) table_name = name.to_s.pluralize before do ActiveRecord::Migration.suppress_messages do ActiveRecord::Migration.creat...
github
keygen-sh/temporary_tables
https://github.com/keygen-sh/temporary_tables
spec/spec_helper.rb
Ruby
mit
49
master
366
# frozen_string_literal: true require 'temporary_tables' require 'active_record' ActiveRecord::Base.logger = Logger.new(STDOUT) if ENV.key?('DEBUG') ActiveRecord::Base.establish_connection( ENV.fetch('DATABASE_URL') { 'sqlite3::memory:' }, ) RSpec.configure do |config| config.expect_with(:rspec) { _1.syntax = :e...
github
keygen-sh/temporary_tables
https://github.com/keygen-sh/temporary_tables
spec/temporary_tables_spec.rb
Ruby
mit
49
master
4,157
# frozen_string_literal: true require 'spec_helper' RSpec.describe TemporaryTables do include TemporaryTables::Methods describe '.temporary_table' do temporary_table :tmp_records do |t| t.string :name end # FIXME(ezekg) is there a better way to test this? before :all do expect(Active...
github
rocknsm/rock-dashboards
https://github.com/rocknsm/rock-dashboards
ecs-configuration/logstash/ruby/logstash-ruby-filter-dns-related.rb
Ruby
apache-2.0
49
master
5,805
require 'set' IPV4_REGEX = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/ IPV6_REGEX = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f...
github
rocknsm/rock-dashboards
https://github.com/rocknsm/rock-dashboards
ecs-configuration/logstash/ruby/logstash-ruby-filter-http-host-related.rb
Ruby
apache-2.0
49
master
2,726
require 'set' IPV4_REGEX = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/ IPV6_REGEX = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f...
github
rocknsm/rock-dashboards
https://github.com/rocknsm/rock-dashboards
ecs-configuration/logstash/ruby/logstash-ruby-filter-ip_clean_and_public.rb
Ruby
apache-2.0
49
master
8,088
require "set" require "ipaddr" IPv6Privatecidr = [ "fc00::/7", "fe80::/10", "ff00::/8", "2001:db8::/32", "2001:20::/28", "::1/128", "::/128", "100::/64", "64:ff9b::/96" ] def register(params) @parent_field = params["parent_field"] @orig_ip_address = params["ip"] end def filter(event) ip_addresses = event.get(@...
github
rocknsm/rock-dashboards
https://github.com/rocknsm/rock-dashboards
ecs-configuration/logstash/ruby/logstash-ruby-filter-community-id.rb
Ruby
apache-2.0
49
master
8,110
require 'socket' require 'digest' require 'base64' TRANSPORT_PROTOS = ['icmp', 'icmp6', 'tcp', 'udp', 'sctp'] PROTO_MAP = { 'icmp' => 1, 'tcp' => 6, 'udp' => 17, 'icmp6' => 58, 'sctp' => 132 } ICMP4_MAP = { # Echo => Reply 8 => 0, # Reply => Echo 0 => 8, # Timestamp => TS reply 13 => 14, # TS...
github
rocknsm/rock-dashboards
https://github.com/rocknsm/rock-dashboards
ecs-configuration/logstash/ruby/logstash-ruby-filter-merge-dict-array.rb
Ruby
apache-2.0
49
master
1,425
def register(params) @source_field = params["source_field"] @target_field = params["target_field"] end def filter(event) # Tag and quit if source field isn't set if @source_field.nil? event.tag("array_dict_merge_source_not_set") return [event] end # Tag and quit if target field isn't set if @tar...
github
storuky/oxymoron
https://github.com/storuky/oxymoron
oxymoron.gemspec
Ruby
mit
49
master
897
require File.expand_path('../lib/oxymoron/version', __FILE__) Gem::Specification.new do |gem| gem.name = "oxymoron" gem.authors = ["Kononenko Paul"] gem.email = ["storuky@gmail.com"] gem.description = "Make your Single Page Application with new architecture" gem.summary = "It'...
github
storuky/oxymoron
https://github.com/storuky/oxymoron
Gemfile
Ruby
mit
49
master
518
source 'https://rubygems.org' # Declare your gem's dependencies in oxymoron.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # Declare any dependencies that are still in development here instead of in ...
github
storuky/oxymoron
https://github.com/storuky/oxymoron
Rakefile
Ruby
mit
49
master
576
begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'Oxymoron' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.rdoc') rd...
github
storuky/oxymoron
https://github.com/storuky/oxymoron
lib/oxymoron.rb
Ruby
mit
49
master
5,290
if defined?(::Rails) require "oxymoron/oxymoron_form_builder" require "oxymoron/config" require "oxymoron/extensions/form_helper" require "oxymoron/engine" end module Oxymoron class Oxymoron def initialize Rails.application.reload_routes! @routes, @states, @resources = {}, {}, {} ...
github
storuky/oxymoron
https://github.com/storuky/oxymoron
lib/oxymoron/engine.rb
Ruby
mit
49
master
1,369
require 'oxymoron/concern' module Oxymoron class Engine < ::Rails::Engine initializer 'oxymoron.dependent_on_routes', after: "sprockets.environment" do Rails.application.config.after_initialize do if Config.rewrite_form_for ActionView::Base.send :include, ActionViewExtensions::FormHelper...
github
storuky/oxymoron
https://github.com/storuky/oxymoron
lib/oxymoron/config.rb
Ruby
mit
49
master
296
module Oxymoron class Config class << self attr_accessor :oxymoron_js_path attr_accessor :rewrite_form_for attr_accessor :form_builder def setup yield self end end @rewrite_form_for = true @form_builder = OxymoronFormBuilder end end