Twilio Rest Resources

List Resources

class Services_Twilio_ListResource

Abstraction of a list resource from the Twilio API.

The list resource implements the IteratorAggregate and the Countable interfaces.

get($sid)

Gets a resource from this list.

Parameters:
  • $sid (string) – The resource SID
Returns:

The resource

Return type:

InstanceResource

getObjectFromJson($params, $idParam = sid)

Construct an InstanceResource with the specified params.

Parameters:
  • $params (array) – usually a JSON HTTP response from the API
Returns:

An instance with properties initialized to the values in the params array.

Return type:

InstanceResource

delete($sid, $params = array())

Deletes a resource from this list.

Parameters:
  • $sid (string) – The resource SID
Return type:

null

getPage($page, $size = 50, $filters = array(), $deep_paging_uri = null)

Returns a page of InstanceResources from this list.

Parameters:
  • $page (int) – The start page
  • $size (int) – Number of items per page
  • $filters (array) – Optional filters
  • $deep_paging_uri (string) – if provided, the $page and $size parameters will be ignored and this URI will be requested directly.
Returns:

A page of resources

Return type:

Services_Twilio_Page

getIterator($page, $size = 50, $filters = array())

Returns an iterable list of instance resources.

Parameters:
  • $page (int) – The start page
  • $size (int) – Number of items per page
  • $filters (array) –

    Optional filters. The filter array can accept full datetimes when StartTime or DateCreated are used. Inequalities should be within the key portion of the array and multiple filter parameters can be combined for more specific searches.

    array('DateCreated>' => '2011-07-05 08:00:00', 'DateCreated<' => '2011-08-01')
    
    array('StartTime<' => '2011-07-05 08:00:00')
    
Returns:

An iterator

Return type:

Services_Twilio_AutoPagingIterator

getPageGenerator($page, $size, $filters = array(), $deep_paging_uri = null)

Retrieve a new page of API results, and update iterator parameters. This function is called by the paging iterator to retrieve a new page and shouldn’t be called directly.

All of the below classes inherit from the ListResource.

Accounts

class Services_Twilio_Rest_Accounts

For more information, see the Account List Resource documentation.

create($params = array())

Create a new subaccount.

Parameters:
  • $params (array) –

    An array of parameters describing the new subaccount. The $params array can contain the following keys:

    FriendlyName
    A description of this account, up to 64 characters long
Returns:

The new subaccount

Return type:

Services_Twilio_Rest_Account

AvailablePhoneNumbers

class Services_Twilio_Rest_AvailablePhoneNumbers

For more information, see the AvailablePhoneNumbers API Resource documentation at twilio.com.

getList($country, $type)

Get a list of available phone numbers.

Parameters:
  • country (string) – The 2-digit country code for numbers (‘US’, ‘GB’, ‘CA’)
  • type (string) – The type of phone number (‘TollFree’ or ‘Local’)
Returns:

An instance of the Services_Twilio_Rest_AvailablePhoneNumbers resource.

property available_phone_numbers

A list of Services_Twilio_Rest_AvailablePhoneNumber instances.

property uri

The uri representing this resource, relative to https://api.twilio.com.

Calls

class Services_Twilio_Rest_Calls

For more information, see the Call List Resource documentation.

create($from, $to, $url, params = array())

Make an outgoing call

Parameters:
  • $from (string) – The phone number to use as the caller id.
  • $to (string) – The number to call formatted with a ‘+’ and country code
  • $url (string) – The fully qualified URL that should be consulted when the call connects. This value can also be an ApplicationSid.
  • $params (array) – An array of optional parameters for this call

The $params array can contain the following keys:

Method
The HTTP method Twilio should use when making its request to the above Url parameter’s value. Defaults to POST. If an ApplicationSid parameter is present, this parameter is ignored.
FallbackUrl
A URL that Twilio will request if an error occurs requesting or executing the TwiML at Url. If an ApplicationSid parameter is present, this parameter is ignored.
FallbackMethod
The HTTP method that Twilio should use to request the FallbackUrl. Must be either GET or POST. Defaults to POST. If an ApplicationSid parameter is present, this parameter is ignored.
StatusCallback
A URL that Twilio will request when the call ends to notify your app. If an ApplicationSid parameter is present, this parameter is ignored.
StatusCallbackMethod
The HTTP method Twilio should use when requesting the above URL. Defaults to POST. If an ApplicationSid parameter is present, this parameter is ignored.
SendDigits
A string of keys to dial after connecting to the number. Valid digits in the string include: any digit (0-9), ‘#’ and ‘*’. For example, if you connected to a company phone number, and wanted to dial extension 1234 and then the pound key, use SendDigits=1234#. Remember to URL-encode this string, since the ‘#’ character has special meaning in a URL.
IfMachine
Tell Twilio to try and determine if a machine (like voicemail) or a human has answered the call. Possible values are Continue and Hangup. See the answering machines section below for more info.
Timeout
The integer number of seconds that Twilio should allow the phone to ring before assuming there is no answer. Default is 60 seconds, the maximum is 999 seconds. Note, you could set this to a low value, such as 15, to hangup before reaching an answering machine or voicemail.

CredentialListMappings

class Services_Twilio_Rest_CredentialListMappings
create($credential_list_sid, $params = array())

Creates a new CredentialListMapping instance

Example usage:

$client->account->sip->domains->get('SDXXX')->credential_list_mappings->create("CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
Parameters:
  • $credential_list_sid (string) – the sid of the CredentialList you’re adding to this domain.
  • $params (array) – a single array of parameters which is serialized and sent directly to the Twilio API.

CredentialLists

class Services_Twilio_Rest_CredentialLists
create($friendly_name, $params = array())

Creates a new CredentialList instance

Example usage:

$client->account->sip->credential_lists->create("MyFriendlyName");
Parameters:
  • $friendly_name (string) – the friendly name of this credential list
  • $params (array) – a single array of parameters which is serialized and sent directly to the Twilio API.

Credentials

class Services_Twilio_Rest_Credentials
create($username, $password, $params = array())

Creates a new Credential instance

Example usage:

$client->account->sip->credential_lists->get('CLXXX')->credentials->create(
    "AwesomeUsername", "SuperSecretPassword",
);
Parameters:
  • $username (string) – the username for the new Credential object
  • $password (string) – the password for the new Credential object
  • $params (array) – a single array of parameters which is serialized and sent directly to the Twilio API.

Domains

class Services_Twilio_Rest_Domains
create($friendly_name, $domain_name, $params = array())

Creates a new Domain instance

Example usage:

$client->account->sip->domains->create(
    "MyFriendlyName", "MyDomainName"
);
Parameters:
  • $friendly_name (string) – the friendly name of this domain
  • $domain_name (string) – the domain name for this domain
  • $params (array) – a single array of parameters which is serialized and sent directly to the Twilio API.

IncomingPhoneNumbers

class Services_Twilio_Rest_IncomingPhoneNumbers

For more information, see the IncomingPhoneNumbers API Resource documentation at twilio.com.

getNumber($number)

Return a phone number instance from its E.164 representation. If more than one number matches the search string, returns the first one.

Example usage:

$number = $client->account->incoming_phone_numbers->getNumber('+14105551234');
echo $number->sid;
Parameters:
  • $number (string) – The number in E.164 format, eg “+684105551234”
Returns:

A Services_Twilio_Rest_IncomingPhoneNumber object, or null

Raises:

a A Services_Twilio_RestException if the number is invalid, not provided in E.164 format or for any other API exception.

class Services_Twilio_Rest_Local
class Services_Twilio_Rest_Mobile
class Services_Twilio_Rest_TollFree

IpAccessControlListMappings

class Services_Twilio_Rest_IpAccessControlListMappings
create($ip_access_control_list_sid, $params = array())

Creates a new IpAccessControlListMapping instance

Example usage:

$client->account->sip->domains->get('SDXXX')->ip_access_control_list_mappings->create("ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
Parameters:
  • $ip_access_control_list_sid (string) – the sid of the IpAccessControList you’re adding to this domain.
  • $params (array) – a single array of parameters which is serialized and sent directly to the Twilio API.

IpAccessControlLists

class Services_Twilio_Rest_IpAccessControlLists
create($friendly_name, $params = array())

Creates a new IpAccessControlLists instance

Example usage:

$client->account->sip->ip_access_control_lists->create("MyFriendlyName");
Parameters:
  • $friendly_name (string) – the friendly name of this ip access control list
  • $params (array) – a single array of parameters which is serialized and sent directly to the Twilio API.
Returns:

the created list

Return type:

Services_Twilio_Rest_IpAccessControlList

IpAddresses

class Services_Twilio_Rest_IpAddresses
create($friendly_name, $ip_address, $params = array())

Creates a new IpAddress instance

Example usage:

$client->account->sip->ip_access_control_lists->get('ALXXX')->ip_addresses->create(
    "FriendlyName", "127.0.0.1"
);
Parameters:
  • $friendly_name (string) – the friendly name for the new IpAddress object
  • $ip_address (string) – the ip address for the new IpAddress object
  • $params (array) – a single array of parameters which is serialized and sent directly to the Twilio API.

Media

class Services_Twilio_Rest_Media

A list of Media objects. For the definitive reference, see the Twilio Media List Documentation.

Members

class Services_Twilio_Rest_Members

For more information, including a list of filter parameters, see the Member List Resource documentation.

front()

Return the Services_Twilio_Rest_Member at the front of the queue.

Messages

class Services_Twilio_Rest_Messages
create($params = array())

Create a new Message instance

Example usage:

$client->account->messages->create(array(
    "Body" => "foo",
    "From" => "+14105551234",
    "To" => "+14105556789",
));
Parameters:
  • $params (array) – a single array of parameters which is serialized and sent directly to the Twilio API. You may find it easier to use the sendMessage helper instead of this function.
sendMessage($from, $to, $body = null, $mediaUrls = null, $params = array())

Send a message

$client = new Services_Twilio('AC123', '123');
$message = $client->account->messages->sendMessage(
    '+14105551234', // From a Twilio number in your account
    '+14105556789', // Text any number
    'Come at the king, you best not miss.'   // Message body (if any)
    array('https://demo.twilio.com/owl.png'),   // An array of MediaUrls
);
Parameters:
  • $from (string) – the from number for the message, this must be a number you purchased from Twilio
  • $to (string) – the message recipient’s phone number
  • $mediaUrls (null (don't include media), a single URL, or an array of URLs to send as media with this message) – the URLs of images to send in this MMS
  • $body (string) – the text to include along with this MMS
  • $params (array) – Any additional params (callback, etc) you’d like to send with this request, these are serialized and sent as POST parameters
Returns:

The created Services_Twilio_Rest_Message

Raises:

Services_Twilio_RestException An exception if the parameters are invalid (for example, the from number is not a Twilio number registered to your account, or is unable to send MMS)

Queues

class Services_Twilio_Rest_Queues

For more information, including a list of filter parameters, see the Queues List Resource documentation.

create($friendly_name, $params = array())

Create a new Services_Twilio_Rest_Queue.

Parameters:
  • $friendly_name (string) – The name of the new Queue.
  • $params (array) – An array of optional parameters and their values, like MaxSize.
Returns:

A new Services_Twilio_Rest_Queue

UsageRecords

class Services_Twilio_Rest_UsageRecords

For more information, including a list of filter parameters, see the UsageRecords List Resource documentation.

getCategory($category)

Return the single UsageRecord corresponding to this category of usage. Valid only for the Records, Today, Yesterday, ThisMonth, LastMonth and AllTime resources.

Parameters:
  • $category (string) – The category to retrieve a usage record for. For a full list of valid categories, see the full Usage Category documentation.
Returns:

Services_Twilio_Rest_UsageRecord A single usage record

UsageTriggers

class Services_Twilio_Rest_UsageTriggers

For more information, including a list of filter parameters, see the UsageTriggers List Resource documentation.

create($category, $value, $url, $params = array())

Create a new UsageTrigger.

Parameters:
  • $category (string) – The category of usage to fire a trigger for. A full list of categories can be found in the Usage Categories documentation.
  • $value (string) – Fire the trigger when usage crosses this value.
  • $url (string) – The URL to request when the trigger fires.
  • $params (array) – Optional parameters for this trigger. A full list of parameters can be found in the Usage Trigger documentation.
Returns:

Services_Twilio_Rest_UsageTrigger The created trigger.

Instance Resources

class Services_Twilio_InstanceResource

Abstraction of an instance resource from the Twilio API.

update($params, $value = null)

Make a request to the API to update an instance resource

Parameters:
  • $params (mixed) – An array of updates, or a property name
  • $value (mixed) – A value with which to update the resource
Return type:

null

Throws:

a RestException if the update fails.

updateAttributes($params)

Add all properties from an associative array (the JSON response body) as properties on this instance resource, except the URI

Parameters:
  • $params (stdClass) – An object containing all of the parameters of this instance
Returns:

Nothing, this is purely side effecting

Return type:

null

synchronize()

Force an HTTP request to the API and update the instance based off the response. This method will perform the HTTP Request even if the instance has already been loaded, any changed attributes will be refreshed from the API.

Returns:Nothing, updates internal state
Return type:null
__get($key)

Get the value of a property on this resource.

Instead of defining all of the properties of an object directly, we rely on the API to tell us which properties an object has. This method will query the API to retrieve a property for an object, if it is not already set on the object.

If the call is to a subresource, eg $client->account->messages, no request is made.

To help with lazy HTTP requests, we don’t actually retrieve an object from the API unless you really need it. Hence, this function may make API requests even if the property you’re requesting isn’t available on the resource.

Parameters:
  • $key (string) – The property name
Return mixed:

Could be anything.

Throws:

a RestException if the update fails.

Below you will find a list of objects created by interacting with the Twilio API, and the methods and properties that can be called on them. These are derived from the ListResource and InstanceResource above.

Account

class Services_Twilio_Rest_Account

For more information, see the Account Instance Resource documentation.

update($params)

Update the account

The $params array is the same as in Services_Twilio_Rest_Accounts::create

property sid

A 34 character string that uniquely identifies this account.

property date_created

The date that this account was created, in GMT in RFC 2822 format

property date_updated

The date that this account was last updated, in GMT in RFC 2822 format.

property friendly_name

A human readable description of this account, up to 64 characters long. By default the FriendlyName is your email address.

property status

The status of this account. Usually active, but can be suspended if you’ve been bad, or closed if you’ve been horrible.

property auth_token

The authorization token for this account. This token should be kept a secret, so no sharing.

Application

class Services_Twilio_Rest_Application

For more information, see the Application Instance Resource documentation.

property sid

A 34 character string that uniquely idetifies this resource.

property date_created

The date that this resource was created, given as GMT RFC 2822 format.

property date_updated

The date that this resource was last updated, given as GMT RFC 2822 format.

property friendly_name

A human readable descriptive text for this resource, up to 64 characters long. By default, the FriendlyName is a nicely formatted version of the phone number.

property account_sid

The unique id of the Account responsible for this phone number.

property api_version

Calls to this phone number will start a new TwiML session with this API version.

property voice_caller_id_lookup

Look up the caller’s caller-ID name from the CNAM database (additional charges apply). Either true or false.

property voice_url

The URL Twilio will request when this phone number receives a call.

property voice_method

The HTTP method Twilio will use when requesting the above Url. Either GET or POST.

property voice_fallback_url

The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by Url.

property voice_fallback_method

The HTTP method Twilio will use when requesting the VoiceFallbackUrl. Either GET or POST.

property status_callback

The URL that Twilio will request to pass status parameters (such as call ended) to your application.

property status_callback_method

The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST.

property sms_url

The URL Twilio will request when receiving an incoming SMS message to this number.

property sms_method

The HTTP method Twilio will use when making requests to the SmsUrl. Either GET or POST.

property sms_fallback_url

The URL that Twilio will request if an error occurs retrieving or executing the TwiML from SmsUrl.

property sms_fallback_method

The HTTP method Twilio will use when requesting the above URL. Either GET or POST.

property uri

The URI for this resource, relative to https://api.twilio.com.

AvailablePhoneNumber

class Services_Twilio_Rest_AvailablePhoneNumber

For more information, see the AvailablePhoneNumber Instance Resource documentation.

property friendly_name

A nicely-formatted version of the phone number.

property phone_number

The phone number, in E.164 (i.e. “+1”) format.

property lata

The LATA of this phone number.

property rate_center

The rate center of this phone number.

property latitude

The latitude coordinate of this phone number.

property longitude

The longitude coordinate of this phone number.

property region

The two-letter state or province abbreviation of this phone number.

property postal_code

The postal (zip) code of this phone number.

property iso_country

Call

class Services_Twilio_Rest_Call

For more information, see the Call Instance Resource documentation.

property sid

A 34 character string that uniquely identifies this resource.

property parent_call_sid

A 34 character string that uniquely identifies the call that created this leg.

property date_created

The date that this resource was created, given as GMT in RFC 2822 format.

property date_updated

The date that this resource was last updated, given as GMT in RFC 2822 format.

property account_sid

The unique id of the Account responsible for creating this call.

property to

The phone number that received this call. e.g., +16175551212 (E.164 format)

property from

The phone number that made this call. e.g., +16175551212 (E.164 format)

property phone_number_sid

If the call was inbound, this is the Sid of the IncomingPhoneNumber that received the call. If the call was outbound, it is the Sid of the OutgoingCallerId from which the call was placed.

property status

A string representing the status of the call. May be QUEUED, RINGING, IN-PROGRESS, COMPLETED, FAILED, BUSY or NO_ANSWER.

property start_time

The start time of the call, given as GMT in RFC 2822 format. Empty if the call has not yet been dialed.

property end_time

The end time of the call, given as GMT in RFC 2822 format. Empty if the call did not complete successfully.

property duration

The length of the call in seconds. This value is empty for busy, failed, unanswered or ongoing calls.

property price

The charge for this call in USD. Populated after the call is completed. May not be immediately available.

property direction

A string describing the direction of the call. inbound for inbound calls, outbound-api for calls initiated via the REST API or outbound-dial for calls initiated by a <Dial> verb.

property answered_by

If this call was initiated with answering machine detection, either human or machine. Empty otherwise.

property forwarded_from

If this call was an incoming call forwarded from another number, the forwarding phone number (depends on carrier supporting forwarding). Empty otherwise.

property caller_name

If this call was an incoming call from a phone number with Caller ID Lookup enabled, the caller’s name. Empty otherwise.

hangup()

Hang up the call

route($url)

Redirect the call to a new URL

Parameters:
  • $url (string) – the new URL to retrieve call flow from.
delete()

Make a request to delete the specified resource.

Return type:boolean

CallerId

class Services_Twilio_Rest_OutgoingCallerId

For more information, see the OutgoingCallerId Instance Resource documentation.

property sid

A 34 character string that uniquely identifies this resource.

property date_created

The date that this resource was created, given in RFC 2822 format.

property date_updated

The date that this resource was last updated, given in RFC 2822 format.

property friendly_name

A human readable descriptive text for this resource, up to 64 characters long. By default, the FriendlyName is a nicely formatted version of the phone number.

property account_sid

The unique id of the Account responsible for this Caller Id.

property phone_number

The incoming phone number. Formatted with a ‘+’ and country code e.g., +16175551212 (E.164 format).

property uri

The URI for this resource, relative to https://api.twilio.com.

Conference

class Services_Twilio_Rest_Conference

For more information, see the Conference Instance Resource documentation.

property sid

A 34 character string that uniquely identifies this conference.

property friendly_name

A user provided string that identifies this conference room.

property status

A string representing the status of the conference. May be init, in-progress, or completed.

property date_created

The date that this conference was created, given as GMT in RFC 2822 format.

property date_updated

The date that this conference was last updated, given as GMT in RFC 2822 format.

property account_sid

The unique id of the Account responsible for creating this conference.

property uri

The URI for this resource, relative to https://api.twilio.com.

property participants

The Services_Twilio_Rest_Participants instance, listing people currently in this conference

CredentialListMapping

class Services_Twilio_Rest_CredentialListMapping

A single CredentialListMapping

property date_created

The date this mapping was created

property date_updated

The date this mapping was updated

property sid

The sid of this mapping

property friendly_name

The friendly name of this mapping

property uri

The uri of this mapping

property subresource_uris

The subresources associated with this mapping (Credentials)

CredentialList

class Services_Twilio_Rest_CredentialList

A single CredentialList

property date_created

The date the credential list was created

property date_updated

The date the credential list was updated

property sid

A 34 character string that identifies this object

property account_sid

The account that created the credential list

property friendly_name

The friendly name of the credential list

property uri

The uri of the credential list

property subresource_uris

The subresources associated with this credential list (Credentials)

Credential

class Services_Twilio_Rest_Credential

A single Credential

property date_created

The date the Credential was created

property date_updated

The date the Credential was updated

property sid

A 34 character string that identifies this object

property account_sid

The account that created this credential

property username

The username of this Credential object

property uri

The uri of this Credential object

Domain

class Services_Twilio_Rest_Domain

A single Domain

property date_created

The date the domain was created

property date_updated

The date the domain was updated

property sid

A 34 character string that identifies this object

property account_sid

The account that created the domain

property friendly_name

The friendly name of the domain

property domain_name

The *.sip.twilio domain for the domain

property auth_type

The auth type used for the domain

property voice_url

The voice url for the domain

property voice_fallback_url

The voice fallback url for the domain

property voice_fallback_method

The voice fallback method for the domain

property voice_status_callback_url

The voice status callback url for the domain

property voice_status_callback_method

The voice status_callback_method for the domain

property uri

The uri of the domain

property subresource_uris

The subresources associated with this domain (IpAccessControlListMappings, CredentialListMappings)

IncomingPhoneNumber

class Services_Twilio_Rest_IncomingPhoneNumber
An object representing a single phone number. For more

information, see the IncomingPhoneNumber Instance Resource documentation.

property sid

A 34 character string that uniquely idetifies this resource.

property date_created

The date that this resource was created, given as GMT RFC 2822 format.

property date_updated

The date that this resource was last updated, given as GMT RFC 2822 format.

property friendly_name

A human readable descriptive text for this resource, up to 64 characters long. By default, the FriendlyName is a nicely formatted version of the phone number.

property account_sid

The unique id of the Account responsible for this phone number.

property phone_number

The incoming phone number. e.g., +16175551212 (E.164 format)

property api_version

Calls to this phone number will start a new TwiML session with this API version.

property voice_caller_id_lookup

Look up the caller’s caller-ID name from the CNAM database (additional charges apply). Either true or false.

property voice_url

The URL Twilio will request when this phone number receives a call.

property voice_method

The HTTP method Twilio will use when requesting the above Url. Either GET or POST.

property voice_fallback_url

The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by Url.

property voice_fallback_method

The HTTP method Twilio will use when requesting the VoiceFallbackUrl. Either GET or POST.

property status_callback

The URL that Twilio will request to pass status parameters (such as call ended) to your application.

property status_callback_method

The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST.

property sms_url

The URL Twilio will request when receiving an incoming SMS message to this number.

property sms_method

The HTTP method Twilio will use when making requests to the SmsUrl. Either GET or POST.

property sms_fallback_url

The URL that Twilio will request if an error occurs retrieving or executing the TwiML from SmsUrl.

property sms_fallback_method

The HTTP method Twilio will use when requesting the above URL. Either GET or POST.

property beta

Whether this number is new to Twilio’s inventory.

property uri

The URI for this resource, relative to https://api.twilio.com.

IpAccessControlListMapping

class Services_Twilio_Rest_IpAccessControlListMapping

A single IpAccessControlListMapping

property date_created

The date this mapping was created

property date_updated

The date this mapping was updated

property sid

The sid of this mapping

property friendly_name

The friendly name of this mapping

property uri

The uri of this mapping

property subresource_uris

The subresources associated with this mapping (IpAddresses)

IpAccessControlList

class Services_Twilio_Rest_IpAccessControlList

A single IpAccessControlList

property date_created

The date the ip access control list was created

property date_updated

The date the ip access control list was updated

property sid

A 34 character string that identifies this object

property account_sid

The account that created the ip access control list

property friendly_name

The friendly name of the ip access control list

property uri

The uri of the ip access control list

property subresource_uris

The subresources associated with this ip access control list (IpAddresses)

IpAddress

class Services_Twilio_Rest_IpAddress

A single IpAddress

property date_created

The date the IpAddress was created

property date_updated

The date the IpAddress was updated

property sid

A 34 character string that identifies this object

property account_sid

The account that created this credential

property friendly_name

The friendly name of the IpAddress

property ip_address

The ip address of this IpAddress object

property uri

The uri of this IpAddress object

Notification

class Services_Twilio_Rest_Notification

For more information, see the Notification Instance Resource documentation.

property sid

A 34 character string that uniquely identifies this resource.

property date_created

The date that this resource was created, given in RFC 2822 format.

property date_updated

The date that this resource was last updated, given in RFC 2822 format.

property account_sid

The unique id of the Account responsible for this notification.

property call_sid

CallSid is the unique id of the call during which the notification was generated. Empty if the notification was generated by the REST API without regard to a specific phone call.

property api_version

The version of the Twilio in use when this notification was generated.

property log

An integer log level corresponding to the type of notification: 0 is ERROR, 1 is WARNING.

property error_code

A unique error code for the error condition. You can lookup errors, with possible causes and solutions, in our Error Dictionary.

property more_info

A URL for more information about the error condition. The URL is a page in our Error Dictionary.

property message_text

The text of the notification.

property message_date

The date the notification was actually generated, given in RFC 2822 format. Due to buffering, this may be slightly different than the DateCreated date.

property request_url

The URL of the resource that generated the notification. If the notification was generated during a phone call: This is the URL of the resource on YOUR SERVER that caused the notification. If the notification was generated by your use of the REST API: This is the URL of the REST resource you were attempting to request on Twilio’s servers.

property request_method

The HTTP method in use for the request that generated the notification. If the notification was generated during a phone call: The HTTP Method use to request the resource on your server. If the notification was generated by your use of the REST API: This is the HTTP method used in your request to the REST resource on Twilio’s servers.

property request_variables

The Twilio-generated HTTP GET or POST variables sent to your server. Alternatively, if the notification was generated by the REST API, this field will include any HTTP POST or PUT variables you sent to the REST API.

property response_headers

The HTTP headers returned by your server.

property response_body

The HTTP body returned by your server.

property uri

The URI for this resource, relative to https://api.twilio.com

Media

class Services_Twilio_Rest_MediaInstance

A single Media object. For the definitive reference, see the Twilio Media Documentation.

property sid

A 34 character string that identifies this object

property account_sid

A 34 character string representing the account that sent the message

property parent_sid

The sid of the message that created this media.

property date_created

The date the message was created

property date_updated

The date the message was updated

property content_type

The content-type of the media.

Member

class Services_Twilio_Rest_Member

For more information about available properties, see the Member Instance Resource documentation.

dequeue($url, $method = 'POST')

Dequeue this member and immediately play the Twiml at the given $url.

Parameters:
  • $url (string) – The Twiml URL to play for this member, after dequeuing them
  • $method (string) – The HTTP method to use when fetching the Twiml URL. Defaults to POST.
Returns:

The dequeued member

Return type:

Member

Participant

class Services_Twilio_Rest_Participant

For more information, see the Participant Instance Resource documentation.

property call_sid

A 34 character string that uniquely identifies the call that is connected to this conference

property conference_sid

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

property date_created

The date that this resource was created, given in RFC 2822 format.

property date_updated

The date that this resource was last updated, given in RFC 2822 format.

property account_sid

The unique id of the Account that created this conference

property muted

true if this participant is currently muted. false otherwise.

property start_conference_on_enter

Was the startConferenceOnEnter attribute set on this participant (true or false)?

property end_conference_on_exit

Was the endConferenceOnExit attribute set on this participant (true or false)?

property uri

The URI for this resource, relative to https://api.twilio.com.

Queue

class Services_Twilio_Rest_Queue

For more information about available properties of a queue, see the Queue Instance Resource documentation. A Queue has one subresource, a list of Services_Twilio_Rest_Members.

Recording

class Services_Twilio_Rest_Recording

For more information, see the Recording Instance Resource documentation.

property sid

A 34 character string that uniquely identifies this resource.

property date_created

The date that this resource was created, given in RFC 2822 format.

property date_updated

The date that this resource was last updated, given in RFC 2822 format.

property account_sid

The unique id of the Account responsible for this recording.

property call_sid

The call during which the recording was made.

property duration

The length of the recording, in seconds.

property api_version

The version of the API in use during the recording.

property uri

The URI for this resource, relative to https://api.twilio.com

property subresource_uris

The list of subresources under this account

property formats

A dictionary of the audio formats available for this recording

array(
    'wav' => 'https://api.twilio.com/path/to/recording.wav',
    'mp3' => 'https://api.twilio.com/path/to/recording.mp3',
)

Message

class Services_Twilio_Rest_Message

A single Message

property date_created

The date the message was created

property date_updated

The date the message was updated

property sid

A 34 character string that identifies this object

property account_sid

The account that sent the message

property body

The body of the message

property num_segments

The number of sms messages used to deliver the body

property num_media

The number of media that are associated with the image

property subresource_uris

The subresources associated with this message (just Media at the moment)

property from

The number this message was sent from

property to

The phone number this message was sent to

delete()

Make a request to delete the specified resource.

Return type:boolean

SmsMessage

class Services_Twilio_Rest_SmsMessage

For more information, see the SMS Message Instance Resource documentation.

property sid

A 34 character string that uniquely identifies this resource.

property date_created

The date that this resource was created, given in RFC 2822 format.

property date_updated

The date that this resource was last updated, given in RFC 2822 format.

property date_sent

The date that the SMS was sent, given in RFC 2822 format.

property account_sid

The unique id of the Account that sent this SMS message.

property from

The phone number that initiated the message in E.164 format. For incoming messages, this will be the remote phone. For outgoing messages, this will be one of your Twilio phone numbers.

property to

The phone number that received the message in E.164 format. For incoming messages, this will be one of your Twilio phone numbers. For outgoing messages, this will be the remote phone.

property body

The text body of the SMS message. Up to 160 characters long.

property status

The status of this SMS message. Either queued, sending, sent, or failed.

property direction

The direction of this SMS message. incoming for incoming messages, outbound-api for messages initiated via the REST API, outbound-call for messages initiated during a call or outbound-reply for messages initiated in response to an incoming SMS.

property price

The amount billed for the message.

property api_version

The version of the Twilio API used to process the SMS message.

property uri

The URI for this resource, relative to https://api.twilio.com

Transcription

class Services_Twilio_Rest_Transcription

For more information, see the Transcription Instance Resource documentation.

property sid

A 34 character string that uniquely identifies this resource.

property date_created

The date that this resource was created, given in RFC 2822 format.

property date_updated

The date that this resource was last updated, given in RFC 2822 format.

property account_sid

The unique id of the Account responsible for this transcription.

property status

A string representing the status of the transcription: in-progress, completed or failed.

property recording_sid

The unique id of the Recording this Transcription was made of.

property duration

The duration of the transcribed audio, in seconds.

property transcription_text

The text content of the transcription.

property price

The charge for this transcript in USD. Populated after the transcript is completed. Note, this value may not be immediately available.

property uri

The URI for this resource, relative to https://api.twilio.com