Permalink
Browse files

Changed the style for Next Caller button to use the hangup class

Fixed queue status page handler to correctly return queue status
  • Loading branch information...
1 parent 8329633 commit 5952c40159fd3cf1ae74354928e638deca98e2bd @kelvl kelvl committed Oct 16, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 docs/browser.rst
View
@@ -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>
@@ -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

0 comments on commit 5952c40

Please sign in to comment.