Skip to content

Commit

Permalink
Merge branch 'master' of github.com:twilio/workshop
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy committed Oct 16, 2012
2 parents 3a00a82 + a9974d5 commit 75a32d5
Show file tree
Hide file tree
Showing 10 changed files with 188 additions and 149 deletions.
Binary file added docs/_static/api_explorer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/recording.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/startapp.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 13 additions & 5 deletions docs/browser.rst
Expand Up @@ -82,7 +82,7 @@ rendering templates on AppEngine. Those are imported from ``util.py``.

.. code-block:: python
from util import gen_token, render_template
from util import generate_token, render_template
class IndexPage(webapp2.RequestHandler):
Expand Down Expand Up @@ -235,7 +235,7 @@ Now we just need to add another button to trigger the hangup.

.. code-block:: html

<button class="next" onclick="next();">
<button class="hangup" onclick="next();">
Next Caller
</button>

Expand All @@ -253,11 +253,19 @@ JSON.
class QueueStatusPage(webapp2.RequestHandler):
queue_sid = "QQ123"
def get(self):
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
q_data = {"queues": client.queues.get(queue_sid)}
self.response.out.write(json.dumps(q_data))
queue = [x for x in client.queues.list() if x.friendly_name == 'radio-callin-queue']
if queue:
q_data = {
"current_size": queue[0].current_size,
'average_wait_time': queue[0].average_wait_time,
}
self.response.out.write(json.dumps(q_data))
else:
self.abort(404)
Add this QueueStatusPage into the WSGIApplication's routing map as
Expand Down
30 changes: 14 additions & 16 deletions docs/custom_twiml.rst
Expand Up @@ -6,7 +6,7 @@ Introduction to TwiML
We've successfully made a phone ring, but how do we actually control call flow?
`TwiML <https://www.twilio.com/docs/api/twiml>`_ is the
answer. TwiML is a set of instructions you can use to tell Twilio what to do
when you receive an incoming call or SMS.
when you receive an incoming call or SMS. TwiML instructions are formatted in XML and are case sensitive.

When someone makes a call or sends an SMS to one of your Twilio numbers, Twilio
will look up the URL associated with that phone number and make a request to
Expand All @@ -29,31 +29,29 @@ And one basic verb for SMS messaging.
To see how these verbs work, let's first take a look at the last section. When we
called your phone, a robot answered with a "Hello World" message. We now know
that TwiML powered that call, so let's take a look. Open
http://twimlets.com/message?Message[0]=Hello+World in your browser.
http://twimlets.com/message?Message=Hello+World in your browser.

.. code-block:: xml
<?xml version="1.0" encoding="UTF-8"?>
<Response><Say>Hello World</Say></Response>
This TwiML uses the `Say`_ verb and says "Hello World" with a text-to-speech
engine. For outgoing calls, we choose the TwiML URL at the time of the call.
For incoming calls, we set a TwiML URL that is fetched each time someone calls
into your Twilio number.
Notice the TwiML used for this application. This application uses the `Say`_ verb
and says "Hello World" with a text-to-speech engine. For outgoing calls, we choose
the TwiML URL at the time of the call. For incoming calls, we set a TwiML URL that
is fetched each time someone calls into your Twilio number.

Twimlbin
----------

TwiML can be hosted anywhere. It can be a static XML document or created
dynamically by a web application. To make developing Twilio applications
easier, you can host your TwiML on `Twimlbin`_.
easier, you can host your TwiML on `Twimlbin`_. Applications with Twimlbin
will autosave and let you know when there might be potential errors with
your TwiML. While we love Twimlbin, we recommend that you host your Twilio
production application on your own server.

Let's rebuild the "Hello World" greeting in `Twimlbin`_.

To create a new bin, go to the Twimlbin homepage and click "Create a new
Twimlbin".

Now let's write our "Hello World" application.
Now let's write our "Hello World" application with the following code.

.. code-block:: xml
Expand All @@ -71,7 +69,7 @@ Configuring your phone number
------------------------------

Once you're done building your application, we'll want to configure your Twilio
phone number. By configuring our Twilio phone number, whenever an incoming call
phone number. By configuring the Twilio phone number, whenever an incoming call
is received on this number, Twilio will fetch the TwiML that is located at that
URL.

Expand Down Expand Up @@ -123,8 +121,8 @@ and paste the following TwiML into your Twimlbin.
This TwiML is invalid. We open the Response and never close it.

Call your phone number. You should hear a recorded message that says "We're
sorry, an application error has occurred".
Call your phone number. Do you hear application recorded message that says "We're
sorry, an application error has occurred"?

Now let's find out why your application error has occurred. The first place
we'll want to look is the `debugger
Expand Down

0 comments on commit 75a32d5

Please sign in to comment.