Class: Punchblock::Component::Tropo::Transfer
- Inherits:
-
ComponentNode
- Object
- Niceogiri::XML::Node
- RayoNode
- Punchblock::CommandNode
- ComponentNode
- Punchblock::Component::Tropo::Transfer
- Includes:
- HasHeaders
- Defined in:
- lib/punchblock/component/tropo/transfer.rb
Defined Under Namespace
Instance Attribute Summary
Attributes inherited from ComponentNode
Attributes inherited from RayoNode
#call_id, #client, #component_id, #connection, #original_component
Class Method Summary collapse
-
.new(options = {}) ⇒ Message::Transfer
Creates an Rayo transfer command.
Instance Method Summary collapse
-
#answer_on_media ⇒ Boolean
If true, the call will be considered “answered” and audio will begin playing as soon as media is received from the far end (ringing / busy signal / etc).
- #answer_on_media=(aom) ⇒ Object
-
#from ⇒ String
The caller ID for the call transfer.
- #from=(transfer_from) ⇒ Object
-
#inspect_attributes ⇒ Object
:nodoc:.
-
#media ⇒ Symbol
Rules for handling media.
- #media=(media) ⇒ Object
-
#ring ⇒ Ring
The ringer to play to the caller while transferring.
- #ring=(ring) ⇒ Object
-
#terminator ⇒ String
The string key press required to abort the transfer.
- #terminator=(terminator) ⇒ Object
-
#timeout ⇒ Integer
How long to wait - in seconds - for an answer, busy signal, or other event to occur.
- #timeout=(timeout) ⇒ Object
-
#to ⇒ Array[String]
The destination(s) for the call transfer.
- #to=(transfer_to) ⇒ Object
Methods included from HasHeaders
#headers, #headers=, #headers_hash
Methods inherited from ComponentNode
#add_event, #initialize, #register_event_handler, #register_initial_handlers, #response=, #stop!, #stop_action, #write_action
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::Component::ComponentNode
Class Method Details
.new(options = {}) ⇒ Message::Transfer
Creates an Rayo transfer command
31 32 33 34 35 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 31 def self.new( = {}) super().tap do |new_node| .each_pair { |k,v| new_node.send :"#{k}=", v } end end |
Instance Method Details
#answer_on_media ⇒ Boolean
Returns If true, the call will be considered “answered” and audio will begin playing as soon as media is received from the far end (ringing / busy signal / etc).
103 104 105 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 103 def answer_on_media read_attr('answer-on-media') == 'true' end |
#answer_on_media=(aom) ⇒ Object
110 111 112 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 110 def answer_on_media=(aom) write_attr 'answer-on-media', aom.to_s end |
#from ⇒ String
Returns The caller ID for the call transfer.
61 62 63 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 61 def from read_attr :from end |
#from=(transfer_from) ⇒ Object
68 69 70 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 68 def from=(transfer_from) write_attr :from, transfer_from end |
#inspect_attributes ⇒ Object
:nodoc:
150 151 152 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 150 def inspect_attributes # :nodoc: [:to, :from, :terminator, :timeout, :answer_on_media] + super end |
#media ⇒ Symbol
Returns Rules for handling media. Can be :direct, where parties negotiate media directly, or :bridge where the media server will bridge audio, allowing media features like recording and ASR.
117 118 119 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 117 def media read_attr 'media', :to_sym end |
#media=(media) ⇒ Object
124 125 126 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 124 def media=(media) write_attr 'media', media end |
#ring ⇒ Ring
Returns the ringer to play to the caller while transferring.
131 132 133 134 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 131 def ring node = find_first '//ns:ring', :ns => self.registered_ns Ring.new node if node end |
#ring=(ring) ⇒ Object
141 142 143 144 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 141 def ring=(ring) ring = Ring.new(ring) unless ring.is_a?(Ring) self << ring end |
#terminator ⇒ String
Returns The string key press required to abort the transfer.
75 76 77 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 75 def terminator read_attr :terminator end |
#terminator=(terminator) ⇒ Object
82 83 84 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 82 def terminator=(terminator) write_attr :terminator, terminator end |
#timeout ⇒ Integer
Returns How long to wait - in seconds - for an answer, busy signal, or other event to occur.
89 90 91 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 89 def timeout read_attr :timeout, :to_i end |
#timeout=(timeout) ⇒ Object
96 97 98 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 96 def timeout=(timeout) write_attr :timeout, timeout end |
#to ⇒ Array[String]
Returns The destination(s) for the call transfer.
40 41 42 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 40 def to find('ns:to', :ns => self.class.registered_ns).map &:text end |
#to=(transfer_to) ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/punchblock/component/tropo/transfer.rb', line 47 def to=(transfer_to) find('//ns:to', :ns => self.class.registered_ns).each &:remove if transfer_to [transfer_to].flatten.each do |i| to = RayoNode.new :to to << i self << to end end end |