Class: Reservation

Reservation

A Reservation correlates a Task and a Worker


Properties:
Name Type Argument Description
accountSid string

The sid of the Twilio account

dateCreated Date

The date the Reservation was created

dateUpdated Date

The date the Reservation was last updated

canceledReasonCode number <optional>

The reason code received when Reservation is canceled

sid string

The sid of the Reservation

status string

The current state of the Reservation. Options: ['pending', 'accepted', 'rejected', 'timeout', 'canceled', 'rescinded', 'wrapping', 'completed'].

task Task <optional>

The Task tied to the Reservation

transfer IncomingTransfer <optional>

the IncomingTransfer tied to the Reservation

timeout number

The number of seconds until the Task times out

workerSid string

The sid of the Worker

workspaceSid string

The sid of the Workspace owning this Reservation

version string

The version of this Reservation

Fires:

Extends

  • EventEmitter

Members


<readonly> accountSid :string

Type:
  • string

<readonly> canceledReasonCode :number|undefined

Type:
  • number | undefined

<readonly> dateCreated :Date

Type:
  • Date

<readonly> dateUpdated :Date

Type:
  • Date

<readonly> sid :string

Type:
  • string

<readonly> status :"pending"|"accepted"|"rejected"|"timeout"|"canceled"|"rescinded"|"wrapping"|"completed"

Type:
  • "pending" | "accepted" | "rejected" | "timeout" | "canceled" | "rescinded" | "wrapping" | "completed"

<readonly> task :Task|Object

Type:

<readonly> timeout :number

Type:
  • number

<readonly> transfer :IncomingTransfer|Object

Type:

<readonly> version :string

Type:
  • string

<readonly> workerSid :string

Type:
  • string

<readonly> workspaceSid :string

Type:
  • string

Methods


accept()

Accept the Reservation

Returns:
  • Rejected if unable to issue Accept instruction on the Reservation
Type
Promise.<this>

call(from, url [, options])

Issue a Call to a Worker

Parameters:
Name Type Argument Description
from string

The caller id for the call to a Worker

url string

A valid TwiML URI that is executed on the answering Worker's leg

options CallOptions <optional>
Returns:
  • Rejected if unable to issue Call instruction on the Reservation
Type
Promise.<this>

complete()

Complete the Reservation

Returns:
  • Rejected if unable to issue Complete instruction on the Reservation
Type
Promise.<this>

conference( [options])

Conference the active Call tied to this Reservation to the Worker

Parameters:
Name Type Argument Description
options ConferenceOptions <optional>
Returns:
  • Rejected if unable to issue Conference instruction on the link Reservation
Type
Promise.<this>

dequeue( [options])

Dequeue the Reservation to the Worker. This will perform telephony to dequeue a Task that was enqueued using the Enqueue TwiML verb. A contact_uri must exist in the Worker's attributes for this call to go through.

Parameters:
Name Type Argument Description
options DequeueOptions <optional>
Returns:
  • Rejected if unable to issue Dequeue instruction on the Reservation
Type
Promise.<this>

fetchLatestVersion()

Fetch the last version of this Reservation

Returns:
Type
Promise.<Reservation>

redirect(callSid, url [, options])

Redirect the active Call tied to this Reservation

Parameters:
Name Type Argument Description
callSid string

The sid of the Call to redirect

url string

A valid TwiML URI that is executed on the Caller's leg upon redirecting

options RedirectOptions <optional>
Returns:
  • Rejected if unable to issue Redirect instruction on the Reservation
Type
Promise.<this>

reject( [options])

Reject the Reservation

Parameters:
Name Type Argument Description
options RejectOptions <optional>
Returns:
  • Rejected if unable to issue Reject instruction on the Reservation
Type
Promise.<this>

updateParticipant(options)

Update the Worker's leg in the Conference associated to this Reservation

Parameters:
Name Type Description
options ReservationParticipantOptions
Returns:
  • Rejected if unable to update the Worker's leg in the Conference tied to the Reservation
Type
Promise.<this>

wrap()

Wrap the Reservation

Returns:
  • Rejected if unable to issue Wrap instruction on the Reservation
Type
Promise.<this>

Events


accepted

Fired when a Reservation has been accepted for this Worker

Parameters:
Name Type Description
reservation Reservation

The accepted Reservation


canceled

Fired when a Reservation has been canceled for this Worker

Parameters:
Name Type Description
reservation Reservation

The canceled Reservation


completed

Fired when an accepted Reservation has been completed for this Worker

Parameters:
Name Type Description
reservation Reservation

The completed Reservation


rejected

Fired when a Reservation has been rejected for this Worker

Parameters:
Name Type Description
reservation Reservation

The rejected Reservation


rescinded

Fired when a Reservation has been rescinded for the Worker

Parameters:
Name Type Description
reservation Reservation

The rescinded Reservation


timeout

Fired when a Reservation has been timed out for this Worker

Parameters:
Name Type Description
reservation Reservation

The timed out Reservation


wrapup

Fired when a Reservation has been wrapped up for the Worker

Parameters:
Name Type Description
reservation Reservation

The wrapped up Reservation