Commit ef0e8bb2 authored by Valentin Samir's avatar Valentin Samir

[sip/asterisk/Manager] Option pour ne pas attendre fullybooted

Par exemple si l'user n'a pas les droits de le recevoir
parent 3dd845d3
......@@ -204,7 +204,7 @@ class History(object):
class Manager(object):
def __init__(self, username, password, timeout=10, server='asterisk.adm.crans.org', port=5038, debug=False, event=False, auto_connect=True, agi=None):
def __init__(self, username, password, timeout=10, server='idefisk.adm.crans.org', port=5038, debug=False, event=False, auto_connect=True, agi=None, wait_fullybooted=True):
self.timeout = timeout
self.server = server
self.port = port
......@@ -218,11 +218,13 @@ class Manager(object):
self._toread = ""
self._agi = agi
self.fullybooted = False
self.wait_fullybooted = wait_fullybooted
self.username = username
self.password = password
self.register_events_callback('FullyBooted', self._FullyBooted)
if self.wait_fullybooted:
self.register_events_callback('FullyBooted', self._FullyBooted)
if auto_connect:
self.connect()
......@@ -305,8 +307,9 @@ class Manager(object):
if len(msg)>1:
self._toread += msg[1]
self.login()
while not self.fullybooted:
self.process_events()
if self.wait_fullybooted:
while not self.fullybooted:
self.process_events()
self.events(self.event)
def register_events_callback(self, event, func):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment