Class: Punchblock::Command::Dial

Inherits:
Punchblock::CommandNode show all
Includes:
HasHeaders
Defined in:
lib/punchblock/command/dial.rb

Instance Attribute Summary

Attributes inherited from RayoNode

#client, #component_id, #connection, #domain, #original_component, #target_call_id, #target_mixer_name

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from HasHeaders

#headers, #headers=, #headers_hash

Methods inherited from Punchblock::CommandNode

#initialize, #response, #write_attr

Methods inherited from RayoNode

class_from_registration, #eql?, import, #inspect, register, #source

Constructor Details

This class inherits a constructor from Punchblock::CommandNode

Class Method Details

+ (Command::Dial) new(options = {})

Create a dial message

Examples:

dial :to => 'tel:+14155551212', :from => 'tel:+13035551212'

returns:
  <dial to='tel:+13055195825' from='tel:+14152226789' xmlns='urn:xmpp:rayo:1' />

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :to (String)

    destination to dial

  • :from (String, Optional)

    what to set the Caller ID to

  • :timeout (Integer, Optional)

    in milliseconds

  • :headers (Array[Header], Hash, Optional)

    SIP headers to attach to the new call. Can be either a hash of key-value pairs, or an array of Header objects.

  • :join (Join, Hash, Optional)

    a join (or set of join parameters) to nest within the dial

Returns:



31
32
33
34
35
# File 'lib/punchblock/command/dial.rb', line 31

def self.new(options = {})
  super().tap do |new_node|
    options.each_pair { |k,v| new_node.send :#{k}=", v }
  end
end

Instance Method Details

- (String) from

The caller ID

Returns:

  • (String)

    the caller ID



51
52
53
# File 'lib/punchblock/command/dial.rb', line 51

def from
  read_attr :from
end

- (Object) from=(dial_from)

Parameters:

  • dial_from (String)

    what to set the caller ID to



57
58
59
# File 'lib/punchblock/command/dial.rb', line 57

def from=(dial_from)
  write_attr :from, dial_from
end

- (Object) inspect_attributes

:nodoc:



95
96
97
# File 'lib/punchblock/command/dial.rb', line 95

def inspect_attributes # :nodoc:
  [:to, :from, :join] + super
end

- (Join) join

The nested join

Returns:

  • (Join)

    the nested join



76
77
78
79
# File 'lib/punchblock/command/dial.rb', line 76

def join
  element = find_first 'ns:join', :ns => Join.registered_ns
  Join.new element if element
end

- (Object) join=(other)

Parameters:

  • other (Hash, Join)

    a join or hash of join options



84
85
86
87
88
# File 'lib/punchblock/command/dial.rb', line 84

def join=(other)
  remove_children :join
  join = Join.new(other) unless other.is_a?(Join)
  self << join
end

- (Object) response=(other)



90
91
92
93
# File 'lib/punchblock/command/dial.rb', line 90

def response=(other)
  @target_call_id = other.id if other.is_a?(Ref)
  super
end

- (Integer) timeout

Timeout in milliseconds

Returns:

  • (Integer)

    timeout in milliseconds



63
64
65
# File 'lib/punchblock/command/dial.rb', line 63

def timeout
  read_attr :timeout, :to_i
end

- (Object) timeout=(other)

Parameters:

  • other (Integer)

    timeout in milliseconds



69
70
71
# File 'lib/punchblock/command/dial.rb', line 69

def timeout=(other)
  write_attr :timeout, other
end

- (String) to

Destination to dial

Returns:

  • (String)

    destination to dial



39
40
41
# File 'lib/punchblock/command/dial.rb', line 39

def to
  read_attr :to
end

- (Object) to=(dial_to)

Parameters:

  • dial_to (String)

    destination to dial



45
46
47
# File 'lib/punchblock/command/dial.rb', line 45

def to=(dial_to)
  write_attr :to, dial_to
end