Module: FSR
- Defined in:
- lib/rack/middleware.rb,
lib/fsr.rb,
lib/fsr/cmd.rb,
lib/fsr/app.rb,
lib/fsr/app/log.rb,
lib/fsr/traited.rb,
lib/fsr/version.rb,
lib/fsr/app/set.rb,
lib/fsr/cmd/enum.rb,
lib/fsr/listener.rb,
lib/fsr/database.rb,
lib/fsr/response.rb,
lib/fsr/app/read.rb,
lib/fsr/app/fifo.rb,
lib/fsr/app/speak.rb,
lib/fsr/cmd/calls.rb,
lib/fsr/cmd/sofia.rb,
lib/fsr/cmd/fsctl.rb,
lib/fsr/app/limit.rb,
lib/fsr/app/answer.rb,
lib/fsr/model/call.rb,
lib/fsr/cmd/status.rb,
lib/fsr/app/hangup.rb,
lib/fsr/app/bridge.rb,
lib/fsr/model/enum.rb,
lib/fsr/fake_socket.rb,
lib/fsr/app/transfer.rb,
lib/fsr/app/fs_break.rb,
lib/fsr/app/fs_sleep.rb,
lib/fsr/app/playback.rb,
lib/fsr/event_socket.rb,
lib/fsr/listener/base.rb,
lib/fsr/app/uuid_dump.rb,
lib/fsr/listener/mock.rb,
lib/fsr/database/core.rb,
lib/fsr/cmd/uuid_dump.rb,
lib/fsr/cmd/originate.rb,
lib/fsr/app/conference.rb,
lib/fsr/command_socket.rb,
lib/fsr/cmd/valet_info.rb,
lib/fsr/app/uuid_setvar.rb,
lib/fsr/app/execute_app.rb,
lib/fsr/app/uuid_getvar.rb,
lib/fsr/cmd/sofia/status.rb,
lib/fsr/listener/inbound.rb,
lib/fsr/cmd/sofia_contact.rb,
lib/fsr/app/bind_meta_app.rb,
lib/fsr/cmd/sofia/profile.rb,
lib/fsr/listener/outbound.rb,
lib/fsr/database/call_limit.rb,
lib/fsr/listener/inbound/event.rb,
lib/fsr/app/play_and_get_digits.rb,
lib/fsr/listener/header_and_content_response.rb
Overview
This module maps to the Free Switch core.db database
TODO Separate these models into their own subdirectories
Defined Under Namespace
Modules: App, Cmd, Database, Listener, Model, Rack, Traited Classes: CommandSocket, EventSocket, FakeSocket, Response
Constant Summary
- FS_INSTALL_PATHS =
Global configuration options
["/usr/local/freeswitch", "/opt/freeswitch", "/usr/freeswitch", "/home/freeswitch/freeswitch"]
- DEFAULT_CALLER_ID_NUMBER =
'8675309'- DEFAULT_CALLER_ID_NAME =
"FSR"- ROOT =
Pathname(__FILE__).dirname..freeze
- FS_ROOT =
FreeSWITCH $$base_dir
find_freeswitch_install- FS_CONFIG_PATH =
FreeSWITCH conf dir
FS_DB_PATH = nil
- FS_DB_PATH =
FreeSWITCH db dir
(FS_ROOT + 'db').freeze
- VERSION =
"0.4.10"
Class Method Summary (collapse)
-
+ (Object) find_freeswitch_install
Find the FreeSWITCH install path if running FSR on a local box with FreeSWITCH installed.
-
+ (Object) load_all_applications
Load all FSR::App classes.
-
+ (Object) load_all_commands(retrying = false)
Load all FSR::Cmd classes.
-
+ (Object) start_ies!(klass, args = {})
Method to start EM for Inbound Event Socket.
-
+ (Object) start_oes!(klass, args = {})
Method to start EM for Outbound Event Socket.
Class Method Details
+ (Object) find_freeswitch_install
Find the FreeSWITCH install path if running FSR on a local box with FreeSWITCH installed. This will enable sqlite db access
82 83 84 85 86 87 88 89 90 |
# File 'lib/fsr.rb', line 82 def self.find_freeswitch_install good_path = FS_INSTALL_PATHS.find do |fs_path| FSR::Log.warn("#{fs_path} is not a directory!") if File.exists?(fs_path) && !File.directory?(fs_path) FSR::Log.warn("#{fs_path} is not readable by this user!") if File.exists?(fs_path) && !File.readable?(fs_path) Dir["#{fs_path}/{conf,db}/"].size == 2 ? fs_path.to_s : nil end FSR::Log.warn("No FreeSWITCH install found, database and configuration functionality disabled") if good_path.nil? good_path end |
+ (Object) load_all_applications
Load all FSR::App classes
47 48 49 50 |
# File 'lib/fsr.rb', line 47 def self.load_all_applications require "fsr/app" App.load_all end |
+ (Object) load_all_commands(retrying = false)
Load all FSR::Cmd classes
40 41 42 43 44 |
# File 'lib/fsr.rb', line 40 def self.load_all_commands( = false) require 'fsr/command_socket' load_all_applications Cmd.load_all end |
+ (Object) start_ies!(klass, args = {})
Method to start EM for Inbound Event Socket
69 70 71 72 73 74 75 76 77 |
# File 'lib/fsr.rb', line 69 def self.start_ies!(klass, args = {}) args[:port] ||= 8021 args[:host] ||= "localhost" EM.run do EventMachine::connect(args[:host], args[:port], klass, args) FSR::Log.info "*** FreeSWITCHer Inbound EventSocket Listener connected to #{args[:host]}:#{args[:port]} ***" FSR::Log.info "*** http://code.rubyists.com/projects/fs" end end |
+ (Object) start_oes!(klass, args = {})
Method to start EM for Outbound Event Socket
53 54 55 56 57 58 59 60 61 |
# File 'lib/fsr.rb', line 53 def self.start_oes!(klass, args = {}) port = args.delete(:port) || "8084" host = args.delete(:host) || "localhost" EM.run do EventMachine::start_server(host, port, klass, args) FSR::Log.info "*** FreeSWITCHer Outbound EventSocket Listener on #{host}:#{port} ***" FSR::Log.info "*** http://code.rubyists.com/projects/fs" end end |