-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
53 lines (43 loc) · 1.9 KB
/
main.py
File metadata and controls
53 lines (43 loc) · 1.9 KB
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
43
44
45
46
47
48
49
50
51
52
53
from handlers.events.publisher import Plublisher
from handlers.susbcribers.peer_status import PeerStatus
from handlers.susbcribers.queue_caller_abandon import QueueCallerAbandon
from handlers.susbcribers.queue_caller_join import QueueCallerJoin
from handlers.susbcribers.reload import Reload
from handlers.susbcribers.bridgeenter import BridgeEnter
from handlers.susbcribers.queue_caller_leave import QueueCallerLeave
from handlers.susbcribers.bridge_create import BridgeCreate
from handlers.susbcribers.bridge_destroy import BridgeDestroy
from handlers.susbcribers.bridge_leave import BridgeLeave
from handlers.susbcribers.dial_begin import DialBegin
from handlers.susbcribers.dial_end import DialEnd
from clients.ami import Ami
from config.ami import config as ami_config
import time
from core.container import Container
events = ['PeerStatus', 'QueueCallerAbandon', 'QueueCallerJoin', 'QueueCallerLeave',
'Reload', 'BridgeCreate', 'BridgeDestroy', 'BridgeEnter', 'BridgeLeave', 'DialBegin',
'DialEnd']
publisher = Plublisher(events)
publisher.register("PeerStatus", PeerStatus())
publisher.register("QueueCallerAbandon", QueueCallerAbandon())
publisher.register("QueueCallerJoin", QueueCallerJoin())
publisher.register("Reload", Reload())
publisher.register("BridgeEnter", BridgeEnter())
publisher.register("QueueCallerLeave", QueueCallerLeave())
publisher.register("BridgeCreate", BridgeCreate())
publisher.register("BridgeDestroy", BridgeDestroy())
publisher.register("BridgeLeave", BridgeLeave())
publisher.register("DialBegin", DialBegin())
publisher.register("DialEnd", DialEnd())
ami_client = Ami(publisher, events, ami_config)
def main():
try:
ami_client.start()
while True:
time.sleep(10)
except (KeyboardInterrupt, SystemExit, Exception):
ami_client.stop()
if __name__ == "__main__":
container = Container()
container.wire(modules=[__name__])
main()