class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::ReservationContext
Public Class Methods
Initialize the ReservationContext
@param [Version] version Version
that contains the resource @param [String] workspace_sid The SID of the Workspace with the
WorkerReservation resource to fetch.
@param [String] worker_sid The SID of the reserved Worker resource with the
WorkerReservation resource to fetch.
@param [String] sid The SID of the WorkerReservation resource to fetch. @return [ReservationContext] ReservationContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb 172 def initialize(version, workspace_sid, worker_sid, sid) 173 super(version) 174 175 # Path Solution 176 @solution = {workspace_sid: workspace_sid, worker_sid: worker_sid, sid: sid, } 177 @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workers/#{@solution[:worker_sid]}/Reservations/#{@solution[:sid]}" 178 end
Public Instance Methods
Fetch the ReservationInstance
@return [ReservationInstance] Fetched ReservationInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb 183 def fetch 184 payload = @version.fetch('GET', @uri) 185 186 ReservationInstance.new( 187 @version, 188 payload, 189 workspace_sid: @solution[:workspace_sid], 190 worker_sid: @solution[:worker_sid], 191 sid: @solution[:sid], 192 ) 193 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb 401 def inspect 402 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 403 "#<Twilio.Taskrouter.V1.ReservationContext #{context}>" 404 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb 394 def to_s 395 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 396 "#<Twilio.Taskrouter.V1.ReservationContext #{context}>" 397 end
Update the ReservationInstance
@param [reservation.Status] reservation_status The new status of the
reservation. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`, or `rescinded`.
@param [String] worker_activity_sid The new worker activity SID if rejecting a
reservation.
@param [String] instruction The assignment instruction for the reservation. @param [String] dequeue_post_work_activity_sid The SID of the Activity resource
to start after executing a Dequeue instruction.
@param [String] dequeue_from The caller ID of the call to the worker when
executing a Dequeue instruction.
@param [String] dequeue_record Whether to record both legs of a call when
executing a Dequeue instruction or which leg to record.
@param [String] dequeue_timeout The timeout for call when executing a Dequeue
instruction.
@param [String] dequeue_to The contact URI of the worker when executing a
Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the {E.164}[https://www.twilio.com/docs/glossary/what-e164] formatted phone number, depending on the destination.
@param [String] dequeue_status_callback_url The callback URL for completed call
event when executing a Dequeue instruction.
@param [String] call_from The Caller ID of the outbound call when executing a
Call instruction.
@param [String] call_record Whether to record both legs of a call when executing
a Call instruction.
@param [String] call_timeout The timeout for a call when executing a Call
instruction.
@param [String] call_to The contact URI of the worker when executing a Call
instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the {E.164}[https://www.twilio.com/docs/glossary/what-e164] formatted phone number, depending on the destination.
@param [String] call_url TwiML
URI executed on answering the worker's leg as a
result of the Call instruction.
@param [String] call_status_callback_url The URL to call for the completed call
event when executing a Call instruction.
@param [Boolean] call_accept Whether to accept a reservation when executing a
Call instruction.
@param [String] redirect_call_sid The Call SID of the call parked in the queue
when executing a Redirect instruction.
@param [Boolean] redirect_accept Whether the reservation should be accepted when
executing a Redirect instruction.
@param [String] redirect_url TwiML
URI to redirect the call to when executing
the Redirect instruction.
@param [String] to The Contact URI of the worker when executing a Conference
instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the {E.164}[https://www.twilio.com/docs/glossary/what-e164] formatted phone number, depending on the destination.
@param [String] from The caller ID of the call to the worker when executing a
Conference instruction.
@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: `POST` or `GET` and the default is `POST`.
@param [Array] status_callback_event The call progress
events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`.
@param [String] timeout The timeout for a call when executing a Conference
instruction.
@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. Defaults to
`false`.
@param [String] beep Whether to play a notification beep when the participant
joins or when to play a beep. 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
agent leaves.
@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. The default is `true`.
@param [String] max_participants The maximum number of participants allowed in
the conference. Can be a positive integer from `2` to `250`. The default value is `250`.
@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 status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`.
@param [String] conference_record Whether to record the conference the
participant is joining or when to record the conference. 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] 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] 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 [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] sip_auth_username The SIP username used for authentication. @param [String] sip_auth_password The SIP password for authentication. @param [Array] dequeue_status_callback_event The call progress events
sent via webhooks as a result of a Dequeue instruction.
@param [String] post_work_activity_sid The new worker activity SID after
executing a Conference instruction.
@param [Boolean] end_conference_on_customer_exit Whether to end the conference
when the customer leaves.
@param [Boolean] beep_on_customer_entrance Whether to play a notification beep
when the customer joins.
@return [ReservationInstance] Updated ReservationInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb 326 def update(reservation_status: :unset, worker_activity_sid: :unset, instruction: :unset, dequeue_post_work_activity_sid: :unset, dequeue_from: :unset, dequeue_record: :unset, dequeue_timeout: :unset, dequeue_to: :unset, dequeue_status_callback_url: :unset, call_from: :unset, call_record: :unset, call_timeout: :unset, call_to: :unset, call_url: :unset, call_status_callback_url: :unset, call_accept: :unset, redirect_call_sid: :unset, redirect_accept: :unset, redirect_url: :unset, to: :unset, from: :unset, 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_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, conference_record: :unset, conference_trim: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, region: :unset, sip_auth_username: :unset, sip_auth_password: :unset, dequeue_status_callback_event: :unset, post_work_activity_sid: :unset, end_conference_on_customer_exit: :unset, beep_on_customer_entrance: :unset) 327 data = Twilio::Values.of({ 328 'ReservationStatus' => reservation_status, 329 'WorkerActivitySid' => worker_activity_sid, 330 'Instruction' => instruction, 331 'DequeuePostWorkActivitySid' => dequeue_post_work_activity_sid, 332 'DequeueFrom' => dequeue_from, 333 'DequeueRecord' => dequeue_record, 334 'DequeueTimeout' => dequeue_timeout, 335 'DequeueTo' => dequeue_to, 336 'DequeueStatusCallbackUrl' => dequeue_status_callback_url, 337 'CallFrom' => call_from, 338 'CallRecord' => call_record, 339 'CallTimeout' => call_timeout, 340 'CallTo' => call_to, 341 'CallUrl' => call_url, 342 'CallStatusCallbackUrl' => call_status_callback_url, 343 'CallAccept' => call_accept, 344 'RedirectCallSid' => redirect_call_sid, 345 'RedirectAccept' => redirect_accept, 346 'RedirectUrl' => redirect_url, 347 'To' => to, 348 'From' => from, 349 'StatusCallback' => status_callback, 350 'StatusCallbackMethod' => status_callback_method, 351 'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e }, 352 'Timeout' => timeout, 353 'Record' => record, 354 'Muted' => muted, 355 'Beep' => beep, 356 'StartConferenceOnEnter' => start_conference_on_enter, 357 'EndConferenceOnExit' => end_conference_on_exit, 358 'WaitUrl' => wait_url, 359 'WaitMethod' => wait_method, 360 'EarlyMedia' => early_media, 361 'MaxParticipants' => max_participants, 362 'ConferenceStatusCallback' => conference_status_callback, 363 'ConferenceStatusCallbackMethod' => conference_status_callback_method, 364 'ConferenceStatusCallbackEvent' => Twilio.serialize_list(conference_status_callback_event) { |e| e }, 365 'ConferenceRecord' => conference_record, 366 'ConferenceTrim' => conference_trim, 367 'RecordingChannels' => recording_channels, 368 'RecordingStatusCallback' => recording_status_callback, 369 'RecordingStatusCallbackMethod' => recording_status_callback_method, 370 'ConferenceRecordingStatusCallback' => conference_recording_status_callback, 371 'ConferenceRecordingStatusCallbackMethod' => conference_recording_status_callback_method, 372 'Region' => region, 373 'SipAuthUsername' => sip_auth_username, 374 'SipAuthPassword' => sip_auth_password, 375 'DequeueStatusCallbackEvent' => Twilio.serialize_list(dequeue_status_callback_event) { |e| e }, 376 'PostWorkActivitySid' => post_work_activity_sid, 377 'EndConferenceOnCustomerExit' => end_conference_on_customer_exit, 378 'BeepOnCustomerEntrance' => beep_on_customer_entrance, 379 }) 380 381 payload = @version.update('POST', @uri, data: data) 382 383 ReservationInstance.new( 384 @version, 385 payload, 386 workspace_sid: @solution[:workspace_sid], 387 worker_sid: @solution[:worker_sid], 388 sid: @solution[:sid], 389 ) 390 end