]> git.ipfire.org Git - ipfire.org.git/blame - src/web/voip.py
voip: Show queues
[ipfire.org.git] / src / web / voip.py
CommitLineData
4235ba55
MT
1#!/usr/bin/python3
2
3import asyncio
4import tornado.web
5
6from . import base
7from . import ui_modules
8
9class IndexHandler(base.BaseHandler):
10 @tornado.web.authenticated
11 async def get(self):
3eba589b
MT
12 # Only staff can view this page
13 if not self.current_user.is_staff():
14 raise tornado.web.HTTPError(403)
15
8e93325b 16 registrations, outbound_registrations, queues, = await asyncio.gather(
4235ba55 17 self.backend.asterisk.get_registrations(),
00465786 18 self.backend.asterisk.get_outbound_registrations(),
8e93325b 19 self.backend.asterisk.get_queues(),
4235ba55
MT
20 )
21
00465786 22 self.render("voip/index.html", registrations=registrations,
8e93325b 23 outbound_registrations=outbound_registrations, queues=queues)
00465786
MT
24
25
26class OutboundRegistrationsModule(ui_modules.UIModule):
27 def render(self, registrations):
28 return self.render_string("voip/modules/outbound-registrations.html",
29 registrations=registrations)
4235ba55
MT
30
31
32class RegistrationsModule(ui_modules.UIModule):
33 def render(self, registrations):
34 return self.render_string("voip/modules/registrations.html",
35 registrations=registrations)
8e93325b
MT
36
37
38class QueuesModule(ui_modules.UIModule):
39 def render(self, queues):
40 return self.render_string("voip/modules/queues.html", queues=queues)