Skip to content

Commit

Permalink
add documentation of recordings, and delete my account sid from the d…
Browse files Browse the repository at this point in the history
…ocumentation
  • Loading branch information
Kevin Burke committed May 4, 2012
1 parent d84b384 commit 27dbe58
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/usage/rest/calls.rst
Expand Up @@ -18,7 +18,7 @@ The :class:`Calls` resource allows you to make outgoing calls:
print $call->length; print $call->length;
print $call->sid; print $call->sid;
Accessing Resources from a specific Call Accessing Resources from a Specific Call
======================================== ========================================


The :class:`Call` resource has some sub resources you can access, such as The :class:`Call` resource has some sub resources you can access, such as
Expand Down
28 changes: 14 additions & 14 deletions docs/usage/rest/phonenumbers.rst
Expand Up @@ -13,8 +13,8 @@ First, we need to search for an available phone number. Use the


.. code-block:: php .. code-block:: php
$accountSid = 'AC58f1e8f2b1c6b88012a4be0c279'; $accountSid = 'AC1234567890abcdef1234567890a';
$authToken = 'b7c3f506c974791449ba57e5c2'; $authToken = 'abcdef1234567890abcdefabcde9';
$client = new Services_Twilio($accountSid, $authToken); $client = new Services_Twilio($accountSid, $authToken);
$numbers = $client->account->available_phone_numbers->getList('US', 'TollFree'); $numbers = $client->account->available_phone_numbers->getList('US', 'TollFree');
Expand All @@ -27,8 +27,8 @@ code, or which contain a certain pattern.


.. code-block:: php .. code-block:: php
$accountSid = 'AC58f1e8f2b1c6b88012a4be0c279'; $accountSid = 'AC1234567890abcdef1234567890a';
$authToken = 'b7c3f506c974791449ba57e5c2'; $authToken = 'abcdef1234567890abcdefabcde9';
$client = new Services_Twilio($accountSid, $authToken); $client = new Services_Twilio($accountSid, $authToken);
Expand All @@ -48,8 +48,8 @@ Once you have a phone number, purchase it by creating a new


.. code-block:: php .. code-block:: php
$accountSid = 'AC58f1e8f2b1c6b88012a4be0c279'; $accountSid = 'AC1234567890abcdef1234567890a';
$authToken = 'b7c3f506c974791449ba57e5c2'; $authToken = 'abcdef1234567890abcdefabcde9';
$client = new Services_Twilio($accountSid, $authToken); $client = new Services_Twilio($accountSid, $authToken);
Expand All @@ -62,8 +62,8 @@ Tying the two together, you can search for a number, and then purchase it.


.. code-block:: php .. code-block:: php
$accountSid = 'AC58f1e8f2b1c6b88012a4be0c279'; $accountSid = 'AC1234567890abcdef1234567890a';
$authToken = 'b7c3f506c974791449ba57e5c2'; $authToken = 'abcdef1234567890abcdefabcde9';
$client = new Services_Twilio($accountSid, $authToken); $client = new Services_Twilio($accountSid, $authToken);
Expand All @@ -80,8 +80,8 @@ You can also purchase a random number with a given area code (US/Canada only):


.. code-block:: php .. code-block:: php
$accountSid = 'AC58f1e8f2b1c6b88012a4be0c279'; $accountSid = 'AC1234567890abcdef1234567890a';
$authToken = 'b7c3f506c974791449ba57e5c2'; $authToken = 'abcdef1234567890abcdefabcde9';
$client = new Services_Twilio($accountSid, $authToken); $client = new Services_Twilio($accountSid, $authToken);
$purchasedNumber = $client->account->incoming_phone_numbers->create(array('AreaCode' => '925')); $purchasedNumber = $client->account->incoming_phone_numbers->create(array('AreaCode' => '925'));
Expand All @@ -98,8 +98,8 @@ in the `Incoming Phone Number REST API Documentation.


.. code-block:: php .. code-block:: php
$accountSid = 'AC58f1e8f2b1c6b88012a4be0c279'; $accountSid = 'AC1234567890abcdef1234567890a';
$authToken = 'b7c3f506c974791449ba57e5c2'; $authToken = 'abcdef1234567890abcdefabcde9';
$client = new Services_Twilio($accountSid, $authToken); $client = new Services_Twilio($accountSid, $authToken);
$numbers = $client->account->incoming_phone_numbers; $numbers = $client->account->incoming_phone_numbers;
Expand All @@ -115,8 +115,8 @@ delete, from the incoming phone numbers object.


.. code-block:: php .. code-block:: php
$accountSid = 'AC58f1e8f2b1c6b88012a4be0c279'; $accountSid = 'AC1234567890abcdef1234567890a';
$authToken = 'b7c3f506c974791449ba57e5c2'; $authToken = 'abcdef1234567890abcdefabcde9';
$client = new Services_Twilio($accountSid, $authToken); $client = new Services_Twilio($accountSid, $authToken);
$number = $client->account->incoming_phone_numbers; $number = $client->account->incoming_phone_numbers;
Expand Down
55 changes: 55 additions & 0 deletions docs/usage/rest/recordings.rst
Expand Up @@ -4,3 +4,58 @@ Recordings


Listing Recordings Listing Recordings
------------------ ------------------

Run the following to get a list of all of your recordings:

.. code-block:: php
$accountSid = 'AC1234567890abcdef1234567890a';
$authToken = 'abcdef1234567890abcdefabcde9';
$client = new Services_Twilio($accountSid, $authToken);
foreach($client->account->recordings as $recording) {
echo "Access recording {$recording->sid} at:" . "\n";
echo $recording->uri;
}
For more information about which properties are available for a recording
object, please see the `Twilio Recordings API Documentation <http://www.twilio.com/docs/api/rest/recording>`_.

Please note that the ``uri`` returned by default is a JSON dictionary
containing metadata about the recording; you can access the .wav version by
stripping the ``.json`` extension from the ``uri`` returned by the library.

Filtering Recordings By Call Sid
--------------------------------

Pass filters as an array to filter your list of recordings, with any of the
filters listed in the `recording list documentation <http://www.twilio.com/docs/api/rest/recording#list-get-filters>`_.

.. code-block:: php
$accountSid = 'AC1234567890abcdef1234567890a';
$authToken = 'abcdef1234567890abcdefabcde9';
$client = new Services_Twilio($accountSid, $authToken);
foreach($client->account->recordings->getIterator(0, 50, array('DateCreated>=' => '2011-01-01')) as $recording) {
echo $recording->uri . "\n";
}
Deleting a Recording
--------------------

To delete a recording, get the sid of the recording, and then pass it to the
client.

.. code-block:: php
$accountSid = 'AC1234567890abcdef1234567890a';
$authToken = 'abcdef1234567890abcdefabcde9';
$client = new Services_Twilio($accountSid, $authToken);
foreach($client->account->recordings as $recording) {
$client->account->recordings->delete($recording->sid);
echo "Deleted recording {$recording->sid}, the first one in the list.";
break;
}

0 comments on commit 27dbe58

Please sign in to comment.