Class: Twilio::REST::Api::V2010::AccountContext::ConferenceContext::ParticipantList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid: nil, conference_sid: nil) ⇒ ParticipantList

Initialize the ParticipantList

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String) (defaults to: nil)

    The unique id of the [Account](www.twilio.com/docs/iam/api/account) that created this conference

  • conference_sid (String) (defaults to: nil)

    A 34 character string that identifies the conference this participant is in



25
26
27
28
29
30
31
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 25

def initialize(version, account_sid: nil, conference_sid: nil)
  super(version)

  # Path Solution
  @solution = {account_sid: , conference_sid: conference_sid}
  @uri = "/Accounts/#{@solution[:account_sid]}/Conferences/#{@solution[:conference_sid]}/Participants.json"
end

Instance Method Details

#create(from: nil, to: nil, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_record: :unset, conference_trim: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, region: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, recording_status_callback_event: :unset, conference_recording_status_callback_event: :unset) ⇒ ParticipantInstance

Retrieve a single page of ParticipantInstance records from the API. Request is executed immediately.

Parameters:

  • from (String) (defaults to: nil)

    The ‘from` phone number that will dial the new conference participant. Values may be a phone number or client id.

  • to (String) (defaults to: nil)

    The phone number, client id, or sip address you are inviting to this conference.

  • status_callback (String) (defaults to: :unset)

    The absolute URL where Twilio should send a webhook with conference event information that you request with the ‘StatusCallbackEvent` parameter.

  • status_callback_method (String) (defaults to: :unset)

    The method Twilio should use when requesting your ‘StatusCallback` URL. Options are `GET` and `POST`. Defaults to `POST`.

  • status_callback_event (String) (defaults to: :unset)

    Specifies which conference state changes should generate a webhook to the ‘StatusCallback` URL. Options are `initiated`, `ringing`, `answered`, and `completed`. To specify multiple values, separate each with a space. Defaults to `completed`.

  • timeout (String) (defaults to: :unset)

    The number of seconds (integer) that Twilio should allow the phone to ring before assuming there is no answer. Defaults to 60 seconds. Minimum allowed timeout is ‘5`, max is `600`. Twilio always adds a 5-second timeout buffer to outgoing calls, so if you enter a timeout value of 10 seconds, you will see an actual timeout closer to 15 seconds.

  • record (Boolean) (defaults to: :unset)

    Records the agent and their conferences, including downtime between conferences. Values may be ‘true` or `false`. Defaults to `false`.

  • muted (Boolean) (defaults to: :unset)

    Specify whether the agent can speak in the conference. Values can be ‘true` or `false`. Defaults to `false`.

  • beep (String) (defaults to: :unset)

    Play a notification beep to the conference when this participant joins. Options are ‘true`, `false`, `onEnter`, or `onExit`. Defaults to `true`.

  • start_conference_on_enter (Boolean) (defaults to: :unset)

    If the conference has not already begun, ‘true` will start the conference when this participant joins. Specifying `false` will mute the participant and play background music until the conference begins. Defaults to `true`.

  • end_conference_on_exit (Boolean) (defaults to: :unset)

    If ‘true`, will end the conference when this participant leaves. Defaults to `false`.

  • wait_url (String) (defaults to: :unset)

    Specify an absolute URL that hosts music to play before the conference starts. Defualts to Twilio’s standard [hold music](www.twilio.com/labs/twimlets/holdmusic).

  • wait_method (String) (defaults to: :unset)

    Specify which method, ‘GET` or `POST`, Twilio should use to request the `WaitUrl` for this conference. Be sure to use `GET` if you are directly requesting static audio files so that Twilio properly caches the files. Defaults to `POST`.

  • early_media (Boolean) (defaults to: :unset)

    Allow an agent to hear the state of the outbound call, including ringing or disconnect messages. Can be ‘true` or `false`. Defaults to `true`.

  • max_participants (String) (defaults to: :unset)

    The maximum number of participants within this agent conference. Values can be positive integers from ‘2`-`10`. Defaults to `10`.

  • conference_record (String) (defaults to: :unset)

    Records the conference that this participant is joining. Options are ‘true`, `false`, `record-from-start`, and `do-not-record`. Deafults to `false`

  • conference_trim (String) (defaults to: :unset)

    Specify whether to trim leading and trailing silence from your recorded conference audio files. Options are ‘trim-silence` and `do-not-trim`. Defaults to `trim-silence`

  • conference_status_callback (String) (defaults to: :unset)

    The absolute URL Twilio should request with conference events specified in ‘ConferenceStatusCallbackEvent`. This value is set by the first Participant to join the conference, and subsequent callback URLs will be ignored.

  • conference_status_callback_method (String) (defaults to: :unset)

    The HTTP method Twilio should use when requesting the ‘ConferenceStatusCallback` URL. Either `GET` or `POST`. Defaults to `POST`.

  • conference_status_callback_event (String) (defaults to: :unset)

    Specifies which conference state changes should generate a webhook to the URL specified in the ‘ConferenceStatusCallback` attribute. Available values are `start`, `end`, `join`, `leave`, `mute`, `hold`, and `speaker`. To specify multiple values, separate them with a space. Defaults to `start` and `end`.

  • recording_channels (String) (defaults to: :unset)

    Set the recording channels for the final agent/conference recording. Either ‘mono` or `dual`. Defaults to `mono`.

  • recording_status_callback (String) (defaults to: :unset)

    Specifies the ‘absolute URL` that Twilio should request when the recording is available if the agent and conference are recorded.

  • recording_status_callback_method (String) (defaults to: :unset)

    The HTTP method Twilio should use when requesting the ‘RecordingStatusCallback`. `GET` or `POST`. Defaults to `POST`.

  • sip_auth_username (String) (defaults to: :unset)

    SIP username used for authenticating.

  • sip_auth_password (String) (defaults to: :unset)

    SIP password for authentication.

  • region (String) (defaults to: :unset)

    Specifies the [region](support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where Twilio should mix the recorded audio. Options are ‘us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, `jp1`.

  • conference_recording_status_callback (String) (defaults to: :unset)

    The ‘absolute URL` Twilio should request when the conference recording is available.

  • conference_recording_status_callback_method (String) (defaults to: :unset)

    The HTTP method Twilio should use when requesting your recording status callback URL, either ‘GET` or `POST`. Defaults to `POST`.

  • recording_status_callback_event (String) (defaults to: :unset)

    Specifies which recording state changes should generate a webhook to the URL specified in the ‘RecordingStatusCallback` attribute. Available values are `in-progress`, `completed`, `failed`. To specify multiple values, separate them with a space. Defaults to `in-progress`, `completed`, `failed`.

  • conference_recording_status_callback_event (String) (defaults to: :unset)

    Specifies which conference recording state changes should generate a webhook to the URL specified in the ‘ConferenceRecordingStatusCallback` attribute. Available values are `in-progress`, `completed`, `failed`. To specify multiple values, separate them with a space. Defaults to `in-progress`, `completed`, `failed`.

Returns:



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 128

def create(from: nil, to: nil, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_record: :unset, conference_trim: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, region: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, recording_status_callback_event: :unset, conference_recording_status_callback_event: :unset)
  data = Twilio::Values.of({
      'From' => from,
      'To' => to,
      'StatusCallback' => status_callback,
      'StatusCallbackMethod' => status_callback_method,
      'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e },
      'Timeout' => timeout,
      'Record' => record,
      'Muted' => muted,
      'Beep' => beep,
      'StartConferenceOnEnter' => start_conference_on_enter,
      'EndConferenceOnExit' => end_conference_on_exit,
      'WaitUrl' => wait_url,
      'WaitMethod' => wait_method,
      'EarlyMedia' => early_media,
      'MaxParticipants' => max_participants,
      'ConferenceRecord' => conference_record,
      'ConferenceTrim' => conference_trim,
      'ConferenceStatusCallback' => conference_status_callback,
      'ConferenceStatusCallbackMethod' => conference_status_callback_method,
      'ConferenceStatusCallbackEvent' => Twilio.serialize_list(conference_status_callback_event) { |e| e },
      'RecordingChannels' => recording_channels,
      'RecordingStatusCallback' => recording_status_callback,
      'RecordingStatusCallbackMethod' => recording_status_callback_method,
      'SipAuthUsername' => sip_auth_username,
      'SipAuthPassword' => sip_auth_password,
      'Region' => region,
      'ConferenceRecordingStatusCallback' => conference_recording_status_callback,
      'ConferenceRecordingStatusCallbackMethod' => conference_recording_status_callback_method,
      'RecordingStatusCallbackEvent' => Twilio.serialize_list(recording_status_callback_event) { |e| e },
      'ConferenceRecordingStatusCallbackEvent' => Twilio.serialize_list(conference_recording_status_callback_event) { |e| e },
  })

  payload = @version.create(
      'POST',
      @uri,
      data: data
  )

  ParticipantInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      conference_sid: @solution[:conference_sid],
  )
end

#eachObject

When passed a block, yields ParticipantInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.



222
223
224
225
226
227
228
229
230
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 222

def each
  limits = @version.read_limits

  page = self.page(page_size: limits[:page_size], )

  @version.stream(page,
                  limit: limits[:limit],
                  page_limit: limits[:page_limit]).each {|x| yield x}
end

#get_page(target_url) ⇒ Page

Retrieve a single page of ParticipantInstance records from the API. Request is executed immediately.

Parameters:

  • target_url (String)

    API-generated URL for the requested results page

Returns:

  • (Page)

    Page of ParticipantInstance



264
265
266
267
268
269
270
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 264

def get_page(target_url)
  response = @version.domain.request(
      'GET',
      target_url
  )
  ParticipantPage.new(@version, response, @solution)
end

#list(muted: :unset, hold: :unset, limit: nil, page_size: nil) ⇒ Array

Lists ParticipantInstance records from the API as a list. Unlike stream(), this operation is eager and will load ‘limit` records into memory before returning.

Parameters:

  • muted (Boolean) (defaults to: :unset)

    Only return participants that are muted or unmuted. Either ‘true` or `false`.

  • hold (Boolean) (defaults to: :unset)

    Only return participants that are on hold or not on hold. Either ‘true` or `false`.

  • limit (Integer) (defaults to: nil)

    Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit

  • page_size (Integer) (defaults to: nil)

    Number of records to fetch per request, when not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)

Returns:

  • (Array)

    Array of up to limit results



191
192
193
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 191

def list(muted: :unset, hold: :unset, limit: nil, page_size: nil)
  self.stream(muted: muted, hold: hold, limit: limit, page_size: page_size).entries
end

#page(muted: :unset, hold: :unset, page_token: :unset, page_number: :unset, page_size: :unset) ⇒ Page

Retrieve a single page of ParticipantInstance records from the API. Request is executed immediately.

Parameters:

  • muted (Boolean) (defaults to: :unset)

    Only return participants that are muted or unmuted. Either ‘true` or `false`.

  • hold (Boolean) (defaults to: :unset)

    Only return participants that are on hold or not on hold. Either ‘true` or `false`.

  • page_token (String) (defaults to: :unset)

    PageToken provided by the API

  • page_number (Integer) (defaults to: :unset)

    Page Number, this value is simply for client state

  • page_size (Integer) (defaults to: :unset)

    Number of records to return, defaults to 50

Returns:

  • (Page)

    Page of ParticipantInstance



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 243

def page(muted: :unset, hold: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
  params = Twilio::Values.of({
      'Muted' => muted,
      'Hold' => hold,
      'PageToken' => page_token,
      'Page' => page_number,
      'PageSize' => page_size,
  })
  response = @version.page(
      'GET',
      @uri,
      params
  )
  ParticipantPage.new(@version, response, @solution)
end

#stream(muted: :unset, hold: :unset, limit: nil, page_size: nil) ⇒ Enumerable

Streams ParticipantInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached.

Parameters:

  • muted (Boolean) (defaults to: :unset)

    Only return participants that are muted or unmuted. Either ‘true` or `false`.

  • hold (Boolean) (defaults to: :unset)

    Only return participants that are on hold or not on hold. Either ‘true` or `false`.

  • limit (Integer) (defaults to: nil)

    Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit.

  • page_size (Integer) (defaults to: nil)

    Number of records to fetch per request, when not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)

Returns:

  • (Enumerable)

    Enumerable that will yield up to limit results



210
211
212
213
214
215
216
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 210

def stream(muted: :unset, hold: :unset, limit: nil, page_size: nil)
  limits = @version.read_limits(limit, page_size)

  page = self.page(muted: muted, hold: hold, page_size: limits[:page_size], )

  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
end

#to_sObject

Provide a user friendly representation



274
275
276
# File 'lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb', line 274

def to_s
  '#<Twilio.Api.V2010.ParticipantList>'
end