Class: VoiceML::ConferencesResource
Overview
Operations on ‘/Conferences` and their participants/recordings.
Constant Summary
collapse
- UPDATE_PARTICIPANT_FIELDS =
{
'Muted' => :muted,
'Hold' => :hold
}.freeze
- LIST_FIELDS =
{
'FriendlyName' => :friendly_name,
'Status' => :status,
'DateCreated' => :date_created,
'DateCreated<' => :date_created_lt,
'DateCreated>' => :date_created_gt,
'DateUpdated' => :date_updated,
'DateUpdated<' => :date_updated_lt,
'DateUpdated>' => :date_updated_gt,
'Page' => :page,
'PageSize' => :page_size,
'PageToken' => :page_token
}.freeze
- CREATE_PARTICIPANT_FIELDS =
{
'From' => :from,
'To' => :to,
'Label' => :label,
'Muted' => :muted,
'StartConferenceOnEnter' => :start_conference_on_enter,
'EndConferenceOnExit' => :end_conference_on_exit,
'Timeout' => :timeout,
'StatusCallback' => :status_callback,
'StatusCallbackMethod' => :status_callback_method,
'StatusCallbackEvent' => :status_callback_event
}.freeze
- UPDATE_RECORDING_FIELDS =
{
'Status' => :status
}.freeze
- LIST_PARTICIPANTS_FIELDS =
{
'Muted' => :muted,
'Hold' => :hold,
'Coaching' => :coaching,
'Page' => :page,
'PageSize' => :page_size,
'PageToken' => :page_token
}.freeze
- LIST_CALL_RECORDINGS_FIELDS =
{
'DateCreated' => :date_created,
'DateCreated<' => :date_created_lt,
'DateCreated>' => :date_created_gt,
'Page' => :page,
'PageSize' => :page_size,
'PageToken' => :page_token
}.freeze
Instance Method Summary
collapse
-
#create_participant(conference_sid, from:, to:, **kwargs) ⇒ VoiceML::Participant
Dial a leg into a conference.
-
#delete_recording(conference_sid, recording_sid) ⇒ nil
-
#each(**kwargs) {|VoiceML::Conference| ... } ⇒ Enumerator<VoiceML::Conference>
-
#end_conference(conference_sid, status: 'completed') ⇒ VoiceML::Conference
-
#get(conference_sid) ⇒ VoiceML::Conference
-
#get_participant(conference_sid, call_sid) ⇒ VoiceML::Participant
-
#get_recording(conference_sid, recording_sid) ⇒ VoiceML::Recording
-
#kick_participant(conference_sid, call_sid) ⇒ nil
-
#list(**kwargs) ⇒ VoiceML::ConferenceList
-
#list_participants(conference_sid, **kwargs) ⇒ VoiceML::ParticipantList
-
#list_recordings(conference_sid, **kwargs) ⇒ VoiceML::RecordingList
-
#update_participant(conference_sid, call_sid, **kwargs) ⇒ VoiceML::Participant
Mute/unmute or hold/unhold a participant.
-
#update_recording(conference_sid, recording_sid, **kwargs) ⇒ VoiceML::Recording
#initialize
Instance Method Details
#create_participant(conference_sid, from:, to:, **kwargs) ⇒ VoiceML::Participant
Dial a leg into a conference.
135
136
137
138
139
140
141
142
143
|
# File 'lib/voiceml/resources/conferences.rb', line 135
def create_participant(conference_sid, from:, to:, **kwargs)
kwargs = kwargs.merge(from: from, to: to)
data = @transport.request(
:post,
path('Conferences', conference_sid, 'Participants'),
form: form_params(CREATE_PARTICIPANT_FIELDS, kwargs)
)
Participant.from_hash(data)
end
|
#delete_recording(conference_sid, recording_sid) ⇒ nil
173
174
175
176
|
# File 'lib/voiceml/resources/conferences.rb', line 173
def delete_recording(conference_sid, recording_sid)
@transport.request(:delete, path('Conferences', conference_sid, 'Recordings', recording_sid))
nil
end
|
#each(**kwargs) {|VoiceML::Conference| ... } ⇒ Enumerator<VoiceML::Conference>
Returns when no block given.
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/voiceml/resources/conferences.rb', line 73
def each(**kwargs, &block)
return enum_for(:each, **kwargs) unless block
page_num = kwargs.delete(:page) || 0
loop do
chunk = list(**kwargs, page: page_num)
chunk.conferences.each(&block)
break if chunk.next_page_uri.nil? || chunk.next_page_uri.empty? || chunk.conferences.empty?
page_num += 1
end
end
|
#end_conference(conference_sid, status: 'completed') ⇒ VoiceML::Conference
End a live conference. v1 supports only ‘status: “completed”`.
92
93
94
95
96
|
# File 'lib/voiceml/resources/conferences.rb', line 92
def end_conference(conference_sid, status: 'completed')
data = @transport.request(:post, path('Conferences', conference_sid),
form: { 'Status' => status })
Conference.from_hash(data)
end
|
86
87
88
|
# File 'lib/voiceml/resources/conferences.rb', line 86
def get(conference_sid)
Conference.from_hash(@transport.request(:get, path('Conferences', conference_sid)))
end
|
#get_participant(conference_sid, call_sid) ⇒ VoiceML::Participant
109
110
111
112
113
|
# File 'lib/voiceml/resources/conferences.rb', line 109
def get_participant(conference_sid, call_sid)
Participant.from_hash(
@transport.request(:get, path('Conferences', conference_sid, 'Participants', call_sid))
)
end
|
#get_recording(conference_sid, recording_sid) ⇒ VoiceML::Recording
156
157
158
159
160
|
# File 'lib/voiceml/resources/conferences.rb', line 156
def get_recording(conference_sid, recording_sid)
Recording.from_hash(
@transport.request(:get, path('Conferences', conference_sid, 'Recordings', recording_sid))
)
end
|
#kick_participant(conference_sid, call_sid) ⇒ nil
127
128
129
130
131
|
# File 'lib/voiceml/resources/conferences.rb', line 127
def kick_participant(conference_sid, call_sid)
@transport.request(:delete,
path('Conferences', conference_sid, 'Participants', call_sid))
nil
end
|
65
66
67
68
69
|
# File 'lib/voiceml/resources/conferences.rb', line 65
def list(**kwargs)
ConferenceList.from_hash(
@transport.request(:get, path('Conferences'), params: form_params(LIST_FIELDS, kwargs))
)
end
|
101
102
103
104
105
106
|
# File 'lib/voiceml/resources/conferences.rb', line 101
def list_participants(conference_sid, **kwargs)
ParticipantList.from_hash(
@transport.request(:get, path('Conferences', conference_sid, 'Participants'),
params: form_params(LIST_PARTICIPANTS_FIELDS, kwargs))
)
end
|
#list_recordings(conference_sid, **kwargs) ⇒ VoiceML::RecordingList
148
149
150
151
152
153
|
# File 'lib/voiceml/resources/conferences.rb', line 148
def list_recordings(conference_sid, **kwargs)
RecordingList.from_hash(
@transport.request(:get, path('Conferences', conference_sid, 'Recordings'),
params: form_params(LIST_CALL_RECORDINGS_FIELDS, kwargs))
)
end
|
#update_participant(conference_sid, call_sid, **kwargs) ⇒ VoiceML::Participant
Mute/unmute or hold/unhold a participant. At least one of ‘muted:` / `hold:` must be set.
117
118
119
120
121
122
123
124
|
# File 'lib/voiceml/resources/conferences.rb', line 117
def update_participant(conference_sid, call_sid, **kwargs)
data = @transport.request(
:post,
path('Conferences', conference_sid, 'Participants', call_sid),
form: form_params(UPDATE_PARTICIPANT_FIELDS, kwargs)
)
Participant.from_hash(data)
end
|
#update_recording(conference_sid, recording_sid, **kwargs) ⇒ VoiceML::Recording
163
164
165
166
167
168
169
170
|
# File 'lib/voiceml/resources/conferences.rb', line 163
def update_recording(conference_sid, recording_sid, **kwargs)
data = @transport.request(
:post,
path('Conferences', conference_sid, 'Recordings', recording_sid),
form: form_params(UPDATE_RECORDING_FIELDS, kwargs)
)
Recording.from_hash(data)
end
|