Module: Librevox::Commands
- Included in:
- CommandSocket, Listener::Base::CommandDelegate
- Defined in:
- lib/librevox/commands.rb
Overview
All commands should call command with the following parameters:
`name` - name of the command
`args` - arguments as a string (optional)
Instance Method Summary collapse
-
#command(name, args = "") ⇒ Object
Executes a generic API command, optionally taking arguments as string.
-
#fsctl(*args) ⇒ Object
FreeSWITCH control messages.
-
#hash(*args) ⇒ Object
Access the hash table that comes with FreeSWITCH.
- #hupall(cause = nil) ⇒ Object
-
#originate(url, args = {}) ⇒ Object
Originate a new call.
- #status ⇒ Object
-
#uuid_bridge(uuid1, uuid2) ⇒ Object
Bridge two call legs together.
-
#uuid_park(uuid) ⇒ Object
Park call.
Instance Method Details
#command(name, args = "") ⇒ Object
Executes a generic API command, optionally taking arguments as string.
13 14 15 16 17 |
# File 'lib/librevox/commands.rb', line 13 def command(name, args = "") parts = ["api", name] parts << args if args && !args.empty? parts.join(" ") end |
#fsctl(*args) ⇒ Object
FreeSWITCH control messages.
53 54 55 |
# File 'lib/librevox/commands.rb', line 53 def fsctl(*args) command "fsctl", args.join(" ") end |
#hash(*args) ⇒ Object
Access the hash table that comes with FreeSWITCH.
28 29 30 |
# File 'lib/librevox/commands.rb', line 28 def hash(*args) command "hash", args.join("/") end |
#hupall(cause = nil) ⇒ Object
57 58 59 |
# File 'lib/librevox/commands.rb', line 57 def hupall(cause = nil) command "hupall", cause end |
#originate(url, args = {}) ⇒ Object
Originate a new call.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/librevox/commands.rb', line 37 def originate(url, args = {}) extension = args.delete(:extension) dialplan = args.delete(:dialplan) context = args.delete(:context) vars = args.map {|k,v| "#{k}=#{v}"}.join(",") arg_string = "{#{vars}}" + [url, extension, dialplan, context].compact.join(" ") command "originate", arg_string end |
#status ⇒ Object
19 20 21 |
# File 'lib/librevox/commands.rb', line 19 def status command "status" end |
#uuid_bridge(uuid1, uuid2) ⇒ Object
Bridge two call legs together. At least one leg must be answered.
73 74 75 |
# File 'lib/librevox/commands.rb', line 73 def uuid_bridge(uuid1, uuid2) command "uuid_bridge", "#{uuid1} #{uuid2}" end |
#uuid_park(uuid) ⇒ Object
Park call.
65 66 67 |
# File 'lib/librevox/commands.rb', line 65 def uuid_park(uuid) command "uuid_park", uuid end |