]> git.ipfire.org Git - ipfire.org.git/blob - src/web/voip.py
b5794b147a4e8e271d6b7b299237bf71379b47e8
[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 registrations, outbound_registrations, queues, = await asyncio.gather(
17 self.backend.asterisk.get_registrations(),
18 self.backend.asterisk.get_outbound_registrations(),
19 self.backend.asterisk.get_queues(),
20 )
21
22 self.render("voip/index.html", registrations=registrations,
23 outbound_registrations=outbound_registrations, queues=queues)
24
25
26 class OutboundRegistrationsModule(ui_modules.UIModule):
27 def render(self, registrations):
28 return self.render_string("voip/modules/outbound-registrations.html",
29 registrations=registrations)
30
31
32 class RegistrationsModule(ui_modules.UIModule):
33 def render(self, registrations):
34 return self.render_string("voip/modules/registrations.html",
35 registrations=registrations)
36
37
38 class QueuesModule(ui_modules.UIModule):
39 def render(self, queues):
40 return self.render_string("voip/modules/queues.html", queues=queues)