Add ommsync mode
This commit is contained in:
parent
f1c340fb3d
commit
a8d9afe3d1
@ -4,11 +4,22 @@ from . import Request, Response
|
||||
|
||||
|
||||
class Open(Request):
|
||||
def __init__(self, username, password, **kwargs):
|
||||
"""
|
||||
Authenticate Message
|
||||
|
||||
Needs to be the first message on a new connection.
|
||||
|
||||
:param username: Username
|
||||
:param password: Password
|
||||
:param UserDeviceSyncClient: If True login as OMM-Sync client. Some operations in OMM-Sync mode might lead to destroy DECT paring.
|
||||
"""
|
||||
def __init__(self, username, password, UserDeviceSyncClient=False, **kwargs):
|
||||
super().__init__("Open", **kwargs)
|
||||
|
||||
self.attrs["username"] = username
|
||||
self.attrs["password"] = password
|
||||
if UserDeviceSyncClient:
|
||||
self.attrs["UserDeviceSyncClient"] = "true"
|
||||
|
||||
@property
|
||||
def username(self):
|
||||
@ -18,6 +29,10 @@ class Open(Request):
|
||||
def password(self):
|
||||
return self.attrs.get("password")
|
||||
|
||||
@property
|
||||
def UserDeviceSyncClient(self):
|
||||
return self.attrs.get("UserDeviceSyncClient")
|
||||
|
||||
class OpenResp(Response):
|
||||
@property
|
||||
def protocolVersion(self):
|
||||
|
@ -13,6 +13,7 @@ class Session:
|
||||
:param username: Username
|
||||
:param password: Password
|
||||
:param port: Port
|
||||
:param ommsync: If True login as OMM-Sync client. Some operations in OMM-Sync mode might lead to destroy DECT paring.
|
||||
:param connection_class: One of :class:`mitel_ommclient2.connection.Connection` or :class:`mitel_ommclient2.connection.SSLConnection`
|
||||
|
||||
Usage::
|
||||
@ -20,11 +21,12 @@ class Session:
|
||||
>>> s.request(mitel_ommclient2.messages.Ping())
|
||||
"""
|
||||
|
||||
def __init__(self, host, username, password, port=None, connection_class=None):
|
||||
def __init__(self, host, username, password, port=None, ommsync=False, connection_class=None):
|
||||
self.host = host
|
||||
self.username = username
|
||||
self.password = password
|
||||
self.port = port
|
||||
self.ommsync = ommsync
|
||||
self.connection_class = connection_class
|
||||
if self.connection_class is None:
|
||||
self.connection_class = connection.Connection
|
||||
@ -58,7 +60,7 @@ class Session:
|
||||
self._connection.connect()
|
||||
|
||||
# Login
|
||||
r = self.request(messages.Open(self.username, self.password))
|
||||
r = self.request(messages.Open(self.username, self.password, UserDeviceSyncClient=self.ommsync))
|
||||
|
||||
r.raise_on_error()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user