Permalink
Browse files

Merge branch 'master' of github.com:twilio/workshop

  • Loading branch information...
2 parents 6c16c46 + 8329633 commit 23a301bdd59ab3a2efaf7e151c665e4a4b3f7618 @kyleconroy kyleconroy committed Oct 16, 2012
Showing with 19 additions and 9 deletions.
  1. +13 −7 docs/browser.rst
  2. +1 −1 docs/callin.rst
  3. +5 −1 templates/index.html
View
@@ -63,7 +63,7 @@ Here is the function we'll use for generating the Capability Token.
from twilio.util import TwilioCapability
- def gen_token(account_sid, auth_token, application_sid):
+ def generate_token(account_sid, auth_token, application_sid):
capability = TwilioCapability(account_sid, auth_token)
# Allow access to the Call-in ApplicationSid we created
capability.allow_client_outgoing(application_sid)
@@ -74,15 +74,21 @@ Answering Queues in the Browser
-------------------------------
The first thing we'll need to build is a web interface. Let's start by adding a
-new AppEngine RequestHandler into ``main.py``.
+new AppEngine RequestHandler into ``main.py``.
+
+We have included some helper functions
+for generating `Capability Tokens <https://www.twilio.com/docs/client/capability-tokens>`_ and
+rendering templates on AppEngine. Those are imported from ``util.py``.
.. code-block:: python
+ from util import gen_token, render_template
+
class IndexPage(webapp2.RequestHandler):
def get(self):
params = {
- "token": gen_token(ACCOUNT_SID, AUTH_TOKEN, APP_SID)
+ "token": generate_token(ACCOUNT_SID, AUTH_TOKEN, APP_SID)
}
self.response.out.write(render_template("index.html", params))
@@ -187,7 +193,7 @@ current call, and dial the next person in the queue.
<Dial hangupOnStar="true">
<Queue>radio-callin-queue</Queue>
</Dial>
- <Redirect></Redirect>
+ <Redirect method="GET"></Redirect>
</Response>
Change your application's Voice URL so it serves this TwiML when dialed.
@@ -196,8 +202,8 @@ Getting the Next Caller From the <Queue>
-----------------------------------------
We want to make it easy to hangup the current call and move to the next one by
-pressing the "#" key on the phone. Twilio Client has a feature for sending DTMF
-tones (the tone when you press "#" on your phone) programmatically.
+pressing the "*" key on the phone. Twilio Client has a feature for sending DTMF
+tones (the tone when you press "*" on your phone) programmatically.
First, we need to hold on to the response of ``Twilio.Device.connect()`` so
let's add a global variable called ``connection`` and have every ``call()``
@@ -217,7 +223,7 @@ Now, we can add a new function, called ``next()``:
function next() {
if (connection) {
- connection.sendDTMF("*");
+ connection.sendDigits("*");
}
}
View
@@ -296,7 +296,7 @@ Remember to change the ``waitUrlMethod`` from ``GET`` to ``POST`` now that we ar
response = twiml.Response()
response.say("You are number %s in line." % self.request.get('QueuePosition'))
response.say("You've been in line for %s seconds." % self.request.get('QueueTime'))
- response.say("The average wait time is currently %s seconds." % self.request.get('AverageQueueTime'))
+ response.say("The average wait time is currently %s seconds." % self.request.get('AvgQueueTime'))
response.play("http://com.twilio.music.rock.s3.amazonaws.com/nickleus_-_original_guitar_song_200907251723.mp3")
self.response.out.write(str(response))
View
@@ -2,6 +2,10 @@
<html>
<head>
<title>Radio Call-In Dashboard</title>
+ <link rel="shortcut icon" href="//static0.twilio.com/packages/favicons/img/Twilio_64.png" />
+ <link rel="apple-touch-icon" href="//static1.twilio.com/packages/favicons/img/Twilio_57.png" />
+ <link rel="apple-touch-icon" sizes="72x72" href="//static0.twilio.com/packages/favicons/img/Twilio_72.png" />
+ <link rel="apple-touch-icon" sizes="114x114" href="//static0.twilio.com/packages/favicons/img/Twilio_114.png" />
<script type="text/javascript"
src="http://static.twilio.com/libs/twiliojs/1.0/twilio.min.js"></script>
<script type="text/javascript"
@@ -26,7 +30,7 @@
});
function call() {
- Twilio.evice.connect();
+ Twilio.Device.connect();
}
</script>
</head>

0 comments on commit 23a301b

Please sign in to comment.