Class: Punchblock::Component::Tropo::Conference
- Inherits:
-
ComponentNode
- Object
- Niceogiri::XML::Node
- RayoNode
- Punchblock::CommandNode
- ComponentNode
- Punchblock::Component::Tropo::Conference
- Defined in:
- lib/punchblock/component/tropo/conference.rb
Defined Under Namespace
Modules: ActiveSpeaker Classes: Announcement, Complete, FinishedSpeaking, Kick, Music, OffHold, OnHold, Speaking
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 = {}) ⇒ Command::Conference
Creates an Rayo conference command.
Instance Method Summary collapse
-
#announcement ⇒ Announcement
The announcement to play to the participant on entry.
- #announcement=(ann) ⇒ Object
-
#inspect_attributes ⇒ Object
:nodoc:.
-
#kick!(options = {}) ⇒ Object
Sends an Rayo kick message for the current Conference.
-
#kick_action(options = {}) ⇒ Command::Conference::Kick
Create an Rayo conference kick message.
-
#moderator ⇒ Boolean
Whether or not the conference should be moderated.
- #moderator=(moderator) ⇒ Object
-
#music ⇒ Music
The music to play to the participant on entry if there’s no moderator present.
- #music=(m) ⇒ Object
-
#mute ⇒ Boolean
If set to true, the user will be muted in the conference.
-
#mute! ⇒ Object
Sends an Rayo mute message for the current Conference.
- #mute=(mute) ⇒ Object
-
#mute_action ⇒ Command::Conference::Mute
Create an Rayo mute message for the current conference.
-
#name ⇒ String
The name of the conference.
- #name=(name) ⇒ Object
- #register_hold_status_handlers ⇒ Object
-
#terminator ⇒ String
This is the touch-tone key (also known as “DTMF digit”) used to exit the conference.
- #terminator=(terminator) ⇒ Object
-
#tone_passthrough ⇒ Boolean
Identifies whether or not conference members can hear the tone generated when a a key on the phone is pressed.
- #tone_passthrough=(tone_passthrough) ⇒ Object
-
#unmute! ⇒ Object
Sends an Rayo unmute message for the current Conference.
-
#unmute_action ⇒ Command::Conference::Unmute
Create an Rayo unmute message for the current conference.
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 = {}) ⇒ Command::Conference
Creates an Rayo conference command
26 27 28 29 30 31 32 33 |
# File 'lib/punchblock/component/tropo/conference.rb', line 26 def self.new( = {}) super().tap do |new_node| .each_pair do |k,v| new_node.send :"#{k}=", v end new_node.register_hold_status_handlers end end |
Instance Method Details
#announcement ⇒ Announcement
Returns the announcement to play to the participant on entry.
108 109 110 111 |
# File 'lib/punchblock/component/tropo/conference.rb', line 108 def announcement node = find_first '//ns:announcement', :ns => self.registered_ns Announcement.new node if node end |
#announcement=(ann) ⇒ Object
118 119 120 121 |
# File 'lib/punchblock/component/tropo/conference.rb', line 118 def announcement=(ann) ann = Announcement.new(ann) unless ann.is_a? Announcement self << ann end |
#inspect_attributes ⇒ Object
:nodoc:
149 150 151 |
# File 'lib/punchblock/component/tropo/conference.rb', line 149 def inspect_attributes # :nodoc: [:name, :mute, :terminator, :tone_passthrough, :moderator, :announcement, :music] + super end |
#kick!(options = {}) ⇒ Object
Sends an Rayo kick message for the current Conference
307 308 309 310 311 312 |
# File 'lib/punchblock/component/tropo/conference.rb', line 307 def kick!( = {}) raise InvalidActionError, "Cannot kick a Conference that is not executing" unless executing? kick_action.tap do |action| write_action action end end |
#kick_action(options = {}) ⇒ Command::Conference::Kick
Create an Rayo conference kick message
297 298 299 |
# File 'lib/punchblock/component/tropo/conference.rb', line 297 def kick_action( = {}) Kick.new .merge(:component_id => component_id, :call_id => call_id) end |
#moderator ⇒ Boolean
Returns Whether or not the conference should be moderated.
94 95 96 |
# File 'lib/punchblock/component/tropo/conference.rb', line 94 def moderator read_attr(:moderator) == 'true' end |
#moderator=(moderator) ⇒ Object
101 102 103 |
# File 'lib/punchblock/component/tropo/conference.rb', line 101 def moderator=(moderator) write_attr :moderator, moderator.to_s end |
#music ⇒ Music
Returns the music to play to the participant on entry if there’s no moderator present.
126 127 128 129 |
# File 'lib/punchblock/component/tropo/conference.rb', line 126 def music node = find_first '//ns:music', :ns => self.registered_ns Music.new node if node end |
#music=(m) ⇒ Object
136 137 138 139 |
# File 'lib/punchblock/component/tropo/conference.rb', line 136 def music=(m) m = Music.new(m) unless m.is_a? Announcement self << m end |
#mute ⇒ Boolean
Returns If set to true, the user will be muted in the conference.
52 53 54 |
# File 'lib/punchblock/component/tropo/conference.rb', line 52 def mute read_attr(:mute) == 'true' end |
#mute! ⇒ Object
Sends an Rayo mute message for the current Conference
249 250 251 252 253 254 255 |
# File 'lib/punchblock/component/tropo/conference.rb', line 249 def mute! raise InvalidActionError, "Cannot mute a Conference that is already muted" if muted? mute_action.tap do |action| result = write_action action muted! if result end end |
#mute=(mute) ⇒ Object
59 60 61 |
# File 'lib/punchblock/component/tropo/conference.rb', line 59 def mute=(mute) write_attr :mute, mute.to_s end |
#mute_action ⇒ Command::Conference::Mute
Create an Rayo mute message for the current conference
242 243 244 |
# File 'lib/punchblock/component/tropo/conference.rb', line 242 def mute_action Command::Mute.new :component_id => component_id, :call_id => call_id end |
#name ⇒ String
Returns the name of the conference.
38 39 40 |
# File 'lib/punchblock/component/tropo/conference.rb', line 38 def name read_attr :name end |
#name=(name) ⇒ Object
45 46 47 |
# File 'lib/punchblock/component/tropo/conference.rb', line 45 def name=(name) write_attr :name, name end |
#register_hold_status_handlers ⇒ Object
153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/punchblock/component/tropo/conference.rb', line 153 def register_hold_status_handlers register_event_handler OnHold do |event| onhold! throw :pass end register_event_handler OffHold do |event| offhold! throw :pass end end |
#terminator ⇒ String
Returns This is the touch-tone key (also known as “DTMF digit”) used to exit the conference.
66 67 68 |
# File 'lib/punchblock/component/tropo/conference.rb', line 66 def terminator read_attr :terminator end |
#terminator=(terminator) ⇒ Object
73 74 75 |
# File 'lib/punchblock/component/tropo/conference.rb', line 73 def terminator=(terminator) write_attr :terminator, terminator end |
#tone_passthrough ⇒ Boolean
Returns Identifies whether or not conference members can hear the tone generated when a a key on the phone is pressed.
80 81 82 |
# File 'lib/punchblock/component/tropo/conference.rb', line 80 def tone_passthrough read_attr('tone-passthrough') == 'true' end |
#tone_passthrough=(tone_passthrough) ⇒ Object
87 88 89 |
# File 'lib/punchblock/component/tropo/conference.rb', line 87 def tone_passthrough=(tone_passthrough) write_attr 'tone-passthrough', tone_passthrough.to_s end |
#unmute! ⇒ Object
Sends an Rayo unmute message for the current Conference
275 276 277 278 279 280 281 |
# File 'lib/punchblock/component/tropo/conference.rb', line 275 def unmute! raise InvalidActionError, "Cannot unmute a Conference that is not muted" unless muted? unmute_action.tap do |action| result = write_action action unmuted! if result end end |