]> git.ipfire.org Git - ipfire.org.git/blob - src/web/voip.py
wiki: Only match usernames when a word starts with @
[ipfire.org.git] / src / web / voip.py
1 #!/usr/bin/python3
2
3 import asyncio
4 import tornado.web
5
6 from . import base
7 from . import ui_modules
8
9 class IndexHandler(base.BaseHandler):
10 @tornado.web.authenticated
11 async def get(self):
12 # Only staff can view this page
13 if not self.current_user.is_staff():
14 raise tornado.web.HTTPError(403)
15
16 # Fetch everything
17 registrations, outbound_registrations, queues, conferences, = \
18 await asyncio.gather(
19 self.backend.asterisk.get_registrations(),
20 self.backend.asterisk.get_outbound_registrations(),
21 self.backend.asterisk.get_queues(),
22 self.backend.asterisk.get_conferences(),
23 )
24
25 self.render("voip/index.html", registrations=registrations, queues=queues,
26 outbound_registrations=outbound_registrations, conferences=conferences)
27
28
29 class OutboundRegistrationsModule(ui_modules.UIModule):
30 def render(self, registrations):
31 return self.render_string("voip/modules/outbound-registrations.html",
32 registrations=registrations)
33
34
35 class RegistrationsModule(ui_modules.UIModule):
36 def render(self, registrations):
37 return self.render_string("voip/modules/registrations.html",
38 registrations=registrations)
39
40
41 class QueuesModule(ui_modules.UIModule):
42 def render(self, queues):
43 return self.render_string("voip/modules/queues.html", queues=queues)
44
45
46 class ConferencesModule(ui_modules.UIModule):
47 def render(self, conferences):
48 return self.render_string("voip/modules/conferences.html", conferences=conferences)