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

Par exemple si l'user n'a pas les droits de le recevoir
This commit is contained in:
Valentin Samir 2015-09-30 10:48:22 +02:00
parent 3dd845d333
commit ef0e8bb22e

View file

@ -204,7 +204,7 @@ class History(object):
class Manager(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.timeout = timeout
self.server = server self.server = server
self.port = port self.port = port
@ -218,10 +218,12 @@ class Manager(object):
self._toread = "" self._toread = ""
self._agi = agi self._agi = agi
self.fullybooted = False self.fullybooted = False
self.wait_fullybooted = wait_fullybooted
self.username = username self.username = username
self.password = password self.password = password
if self.wait_fullybooted:
self.register_events_callback('FullyBooted', self._FullyBooted) self.register_events_callback('FullyBooted', self._FullyBooted)
if auto_connect: if auto_connect:
self.connect() self.connect()
@ -305,6 +307,7 @@ class Manager(object):
if len(msg)>1: if len(msg)>1:
self._toread += msg[1] self._toread += msg[1]
self.login() self.login()
if self.wait_fullybooted:
while not self.fullybooted: while not self.fullybooted:
self.process_events() self.process_events()
self.events(self.event) self.events(self.event)