-
Notifications
You must be signed in to change notification settings - Fork 5
/
notifier.py
42 lines (31 loc) · 1.13 KB
/
notifier.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
# Copyright 2018-2019 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from xivo_bus.resources.call_pickup.event import (
CreateCallPickupEvent,
DeleteCallPickupEvent,
EditCallPickupEvent,
)
from xivo_confd import bus, sysconfd
class CallPickupNotifier(object):
def __init__(self, bus, sysconfd):
self.bus = bus
self.sysconfd = sysconfd
def send_sysconfd_handlers(self):
handlers = {
'ipbx': ['module reload res_pjsip.so', 'module reload chan_sccp.so'],
'agentbus': [],
}
self.sysconfd.exec_request_handlers(handlers)
def created(self, call_pickup):
event = CreateCallPickupEvent(call_pickup.id)
self.bus.send_bus_event(event)
def edited(self, call_pickup):
event = EditCallPickupEvent(call_pickup.id)
self.bus.send_bus_event(event)
def deleted(self, call_pickup):
self.send_sysconfd_handlers()
event = DeleteCallPickupEvent(call_pickup.id)
self.bus.send_bus_event(event)
def build_notifier():
return CallPickupNotifier(bus, sysconfd)