class Twilio::REST::Api::V2010::AccountContext::ConferenceContext::ParticipantList
Public Class Methods
Initialize the ParticipantList
@param [Version] version Version
that contains the resource @param [String] account_sid The SID of the
{Account}[https://www.twilio.com/docs/iam/api/account] that created the Participant resource.
@param [String] conference_sid The SID of the conference the participant is in. @return [ParticipantList] ParticipantList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb 24 def initialize(version, account_sid: nil, conference_sid: nil) 25 super(version) 26 27 # Path Solution 28 @solution = {account_sid: account_sid, conference_sid: conference_sid} 29 @uri = "/Accounts/#{@solution[:account_sid]}/Conferences/#{@solution[:conference_sid]}/Participants.json" 30 end
Public Instance Methods
Create the ParticipantInstance
@param [String] from The phone number, Client
identifier, or username portion of
SIP address that made this call. Phone numbers are in {E.164}[https://www.twilio.com/docs/glossary/what-e164] format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified {outgoing caller id}[https://www.twilio.com/docs/voice/api/outgoing-caller-ids] for your account. If the `to` parameter is a phone number, `from` must also be a phone number. If `to` is sip address, this value of `from` should be a username portion to be used to populate the P-Asserted-Identity header that is passed to the SIP endpoint.
@param [String] to The phone number, SIP address, or Client
identifier that
received this call. Phone numbers are in {E.164}[https://www.twilio.com/docs/glossary/what-e164] format (e.g., +16175551212). SIP addresses are formatted as `sip:name@company.com`. Client identifiers are formatted `client:name`. {Custom parameters}[https://www.twilio.com/docs/voice/api/conference-participant-resource#custom-parameters] may also be specified.
@param [String] status_callback The URL we should call using the
`status_callback_method` to send status information to your application.
@param [String] status_callback_method The HTTP
method we should use to call
`status_callback`. Can be: `GET` and `POST` and defaults to `POST`.
@param [Array] status_callback_event The conference state changes that
should generate a call to `status_callback`. Can be: `initiated`, `ringing`, `answered`, and `completed`. Separate multiple values with a space. The default value is `completed`.
@param [String] label A label for this participant. If one is supplied, it may
subsequently be used to fetch, update or delete the participant.
@param [String] timeout The number of seconds that we should allow the phone to
ring before assuming there is no answer. Can be an integer between `5` and `600`, inclusive. The default value is `60`. We always add a 5-second timeout buffer to outgoing calls, so value of 10 would result in an actual timeout that was closer to 15 seconds.
@param [Boolean] record Whether to record the participant and their conferences,
including the time between conferences. Can be `true` or `false` and the default is `false`.
@param [Boolean] muted Whether the agent is muted in the conference. Can be
`true` or `false` and the default is `false`.
@param [String] beep Whether to play a notification beep to the conference when
the participant joins. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`.
@param [Boolean] start_conference_on_enter Whether to start the conference when
the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference.
@param [Boolean] end_conference_on_exit Whether to end the conference when the
participant leaves. Can be: `true` or `false` and defaults to `false`.
@param [String] wait_url The URL we should call using the `wait_method` for the
music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. {Learn more about hold music}[https://www.twilio.com/labs/twimlets/holdmusic].
@param [String] wait_method The HTTP
method we should use to call `wait_url`.
Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file.
@param [Boolean] early_media Whether to allow an agent to hear the state of the
outbound call, including ringing or disconnect messages. Can be: `true` or `false` and defaults to `true`.
@param [String] max_participants The maximum number of participants in the
conference. Can be a positive integer from `2` to `250`. The default value is `250`.
@param [String] conference_record Whether to record the conference the
participant is joining. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`.
@param [String] conference_trim Whether to trim leading and trailing silence
from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`.
@param [String] conference_status_callback The URL we should call using the
`conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored.
@param [String] conference_status_callback_method The HTTP
method we should use
to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`.
@param [Array] conference_status_callback_event The conference state
changes that should generate a call to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `modify`, `speaker`, and `announcement`. Separate multiple values with a space. Defaults to `start end`.
@param [String] recording_channels The recording channels for the final
recording. Can be: `mono` or `dual` and the default is `mono`.
@param [String] recording_status_callback The URL that we should call using the
`recording_status_callback_method` when the recording status changes.
@param [String] recording_status_callback_method The HTTP
method we should use
when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`.
@param [String] sip_auth_username The SIP username used for authentication. @param [String] sip_auth_password The SIP password for authentication. @param [String] region The
{region}[https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls] where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`.
@param [String] conference_recording_status_callback The URL we should call
using the `conference_recording_status_callback_method` when the conference recording is available.
@param [String] conference_recording_status_callback_method The HTTP
method we
should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`.
@param [Array] recording_status_callback_event The recording state
changes that should generate a call to `recording_status_callback`. Can be: `started`, `in-progress`, `paused`, `resumed`, `stopped`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress completed failed'`.
@param [Array] conference_recording_status_callback_event The conference
recording state changes that generate a call to `conference_recording_status_callback`. Can be: `in-progress`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress completed failed'`
@param [Boolean] coaching Whether the participant is coaching another call. Can
be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined.
@param [String] call_sid_to_coach The SID of the participant who is being
`coached`. The participant being coached is the only participant who can hear the participant who is `coaching`.
@param [String] jitter_buffer_size Jitter buffer size for the connecting
participant. Twilio will use this setting to apply Jitter Buffer before participant's audio is mixed into the conference. Can be: `off`, `small`, `medium`, and `large`. Default to `large`.
@param [String] byoc The SID of a BYOC (Bring Your Own Carrier) trunk to route
this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta)
@param [String] caller_id The phone number, Client
identifier, or username
portion of SIP address that made this call. Phone numbers are in {E.164}[https://www.twilio.com/docs/glossary/what-e164] format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified {outgoing caller id}[https://www.twilio.com/docs/voice/api/outgoing-caller-ids] for your account. If the `to` parameter is a phone number, `callerId` must also be a phone number. If `to` is sip address, this value of `callerId` should be a username portion to be used to populate the From header that is passed to the SIP endpoint.
@param [String] call_reason The Reason for the outgoing call. Use it to specify
the purpose of the call that is presented on the called party's phone. (Branded Calls Beta)
@param [String] recording_track The audio track to record for the call. Can be:
`inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is sent from Twilio. `both` records the audio that is received and sent by Twilio.
@param [String] time_limit The maximum duration of the call in seconds.
Constraints depend on account and configuration.
@return [ParticipantInstance] Created ParticipantInstance
# File lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb 173 def create(from: nil, to: nil, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, label: :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, coaching: :unset, call_sid_to_coach: :unset, jitter_buffer_size: :unset, byoc: :unset, caller_id: :unset, call_reason: :unset, recording_track: :unset, time_limit: :unset) 174 data = Twilio::Values.of({ 175 'From' => from, 176 'To' => to, 177 'StatusCallback' => status_callback, 178 'StatusCallbackMethod' => status_callback_method, 179 'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e }, 180 'Label' => label, 181 'Timeout' => timeout, 182 'Record' => record, 183 'Muted' => muted, 184 'Beep' => beep, 185 'StartConferenceOnEnter' => start_conference_on_enter, 186 'EndConferenceOnExit' => end_conference_on_exit, 187 'WaitUrl' => wait_url, 188 'WaitMethod' => wait_method, 189 'EarlyMedia' => early_media, 190 'MaxParticipants' => max_participants, 191 'ConferenceRecord' => conference_record, 192 'ConferenceTrim' => conference_trim, 193 'ConferenceStatusCallback' => conference_status_callback, 194 'ConferenceStatusCallbackMethod' => conference_status_callback_method, 195 'ConferenceStatusCallbackEvent' => Twilio.serialize_list(conference_status_callback_event) { |e| e }, 196 'RecordingChannels' => recording_channels, 197 'RecordingStatusCallback' => recording_status_callback, 198 'RecordingStatusCallbackMethod' => recording_status_callback_method, 199 'SipAuthUsername' => sip_auth_username, 200 'SipAuthPassword' => sip_auth_password, 201 'Region' => region, 202 'ConferenceRecordingStatusCallback' => conference_recording_status_callback, 203 'ConferenceRecordingStatusCallbackMethod' => conference_recording_status_callback_method, 204 'RecordingStatusCallbackEvent' => Twilio.serialize_list(recording_status_callback_event) { |e| e }, 205 'ConferenceRecordingStatusCallbackEvent' => Twilio.serialize_list(conference_recording_status_callback_event) { |e| e }, 206 'Coaching' => coaching, 207 'CallSidToCoach' => call_sid_to_coach, 208 'JitterBufferSize' => jitter_buffer_size, 209 'Byoc' => byoc, 210 'CallerId' => caller_id, 211 'CallReason' => call_reason, 212 'RecordingTrack' => recording_track, 213 'TimeLimit' => time_limit, 214 }) 215 216 payload = @version.create('POST', @uri, data: data) 217 218 ParticipantInstance.new( 219 @version, 220 payload, 221 account_sid: @solution[:account_sid], 222 conference_sid: @solution[:conference_sid], 223 ) 224 end
When passed a block, yields ParticipantInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb 282 def each 283 limits = @version.read_limits 284 285 page = self.page(page_size: limits[:page_size], ) 286 287 @version.stream(page, 288 limit: limits[:limit], 289 page_limit: limits[:page_limit]).each {|x| yield x} 290 end
Retrieve a single page of ParticipantInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of ParticipantInstance
# File lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb 325 def get_page(target_url) 326 response = @version.domain.request( 327 'GET', 328 target_url 329 ) 330 ParticipantPage.new(@version, response, @solution) 331 end
Lists ParticipantInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Boolean] muted Whether to return only participants that are muted. Can
be: `true` or `false`.
@param [Boolean] hold Whether to return only participants that are on hold. Can
be: `true` or `false`.
@param [Boolean] coaching Whether to return only participants who are coaching
another call. Can be: `true` or `false`.
@param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit
@param [Integer] page_size 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)
@return [Array] Array of up to limit results
# File lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb 243 def list(muted: :unset, hold: :unset, coaching: :unset, limit: nil, page_size: nil) 244 self.stream( 245 muted: muted, 246 hold: hold, 247 coaching: coaching, 248 limit: limit, 249 page_size: page_size 250 ).entries 251 end
Retrieve a single page of ParticipantInstance
records from the API. Request
is executed immediately. @param [Boolean] muted Whether to return only participants that are muted. Can
be: `true` or `false`.
@param [Boolean] hold Whether to return only participants that are on hold. Can
be: `true` or `false`.
@param [Boolean] coaching Whether to return only participants who are coaching
another call. Can be: `true` or `false`.
@param [String] page_token PageToken provided by the API @param [Integer] page_number Page
Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page
of ParticipantInstance
# File lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb 305 def page(muted: :unset, hold: :unset, coaching: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 306 params = Twilio::Values.of({ 307 'Muted' => muted, 308 'Hold' => hold, 309 'Coaching' => coaching, 310 'PageToken' => page_token, 311 'Page' => page_number, 312 'PageSize' => page_size, 313 }) 314 315 response = @version.page('GET', @uri, params: params) 316 317 ParticipantPage.new(@version, response, @solution) 318 end
Streams ParticipantInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Boolean] muted Whether to return only participants that are muted. Can
be: `true` or `false`.
@param [Boolean] hold Whether to return only participants that are on hold. Can
be: `true` or `false`.
@param [Boolean] coaching Whether to return only participants who are coaching
another call. Can be: `true` or `false`.
@param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit.
@param [Integer] page_size 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)
@return [Enumerable] Enumerable that will yield up to limit results
# File lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb 270 def stream(muted: :unset, hold: :unset, coaching: :unset, limit: nil, page_size: nil) 271 limits = @version.read_limits(limit, page_size) 272 273 page = self.page(muted: muted, hold: hold, coaching: coaching, page_size: limits[:page_size], ) 274 275 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 276 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb 335 def to_s 336 '#<Twilio.Api.V2010.ParticipantList>' 337 end