Class: Punchblock::Command::Redirect

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

Constant Summary

Constants inherited from RayoNode

RayoNode::InvalidNodeError

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, #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

.new(options = {}) ⇒ Command::Redirect

Create a Rayo redirect command

Examples:

Redirect.new(:to => 'tel:+14045551234').to_xml

returns:
    <redirect to="tel:+14045551234" xmlns="urn:xmpp:rayo:1"/>

Parameters:

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

Options Hash (options):

  • :to (String)

    redirect target

  • :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.

Returns:



27
28
29
30
31
32
# File 'lib/punchblock/command/redirect.rb', line 27

def self.new(options = {})
  super().tap do |new_node|
    new_node.to = options[:to]
    new_node.headers = options[:headers]
  end
end

Instance Method Details

#inspect_attributesObject

:nodoc:



46
47
48
# File 'lib/punchblock/command/redirect.rb', line 46

def inspect_attributes # :nodoc:
  [:to] + super
end

#toString

Returns the redirect target.

Returns:

  • (String)

    the redirect target



36
37
38
# File 'lib/punchblock/command/redirect.rb', line 36

def to
  read_attr :to
end

#to=(redirect_to) ⇒ Object

Parameters:

  • redirect_to (String)

    redirect target



42
43
44
# File 'lib/punchblock/command/redirect.rb', line 42

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