class Asterisk::Action
Public Class Methods
new(command, options={})
click to toggle source
# File lib/asterisk/action.rb, line 8 def initialize(command, options={}) @command = command @options = options @options[:action_id] = Random.rand(99999999) unless @options[:action_id] end
parse(str)
click to toggle source
# File lib/asterisk/action.rb, line 14 def self.parse(str) hash = self.parse_lines(str) Asterisk::Action.new(hash.delete(:action), hash) end
Public Instance Methods
action_id()
click to toggle source
# File lib/asterisk/action.rb, line 24 def action_id @options[:action_id] end
send(connection)
click to toggle source
send the ami action
# File lib/asterisk/action.rb, line 20 def send(connection) connection.write(self.to_ami) end
to_ami()
click to toggle source
convert the action to ami string to send down wire
# File lib/asterisk/action.rb, line 29 def to_ami ami_lines(@command, @options) end
to_hash()
click to toggle source
# File lib/asterisk/action.rb, line 33 def to_hash {:action => @command}.merge(@options) end