Compare commits
2 Commits
cf3c16c66a
...
bd68cbd7d8
Author | SHA1 | Date | |
---|---|---|---|
bd68cbd7d8 | |||
0e19927610 |
7
docs/api/client.rst
Normal file
7
docs/api/client.rst
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
mitel\_ommclient2.client module
|
||||||
|
===============================
|
||||||
|
|
||||||
|
.. automodule:: mitel_ommclient2.client
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
7
docs/api/connection.rst
Normal file
7
docs/api/connection.rst
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
mitel\_ommclient2.connection module
|
||||||
|
===================================
|
||||||
|
|
||||||
|
.. automodule:: mitel_ommclient2.connection
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
7
docs/api/exceptions.rst
Normal file
7
docs/api/exceptions.rst
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
mitel\_ommclient2.exceptions module
|
||||||
|
===================================
|
||||||
|
|
||||||
|
.. automodule:: mitel_ommclient2.exceptions
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
@ -6,4 +6,7 @@ API Documentation
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 4
|
:maxdepth: 4
|
||||||
|
|
||||||
mitel_ommclient2
|
client
|
||||||
|
connection
|
||||||
|
exceptions
|
||||||
|
messages
|
@ -1,53 +1,32 @@
|
|||||||
mitel\_ommclient2.messages package
|
mitel\_ommclient2.messages package
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
Submodules
|
.. automodule:: mitel_ommclient2.messages
|
||||||
----------
|
:members:
|
||||||
|
:undoc-members:
|
||||||
mitel\_ommclient2.messages.getaccount module
|
:show-inheritance:
|
||||||
--------------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: mitel_ommclient2.messages.getaccount
|
.. automodule:: mitel_ommclient2.messages.getaccount
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
mitel\_ommclient2.messages.getppdev module
|
|
||||||
------------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: mitel_ommclient2.messages.getppdev
|
.. automodule:: mitel_ommclient2.messages.getppdev
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
mitel\_ommclient2.messages.getppuser module
|
|
||||||
-------------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: mitel_ommclient2.messages.getppuser
|
.. automodule:: mitel_ommclient2.messages.getppuser
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
mitel\_ommclient2.messages.open module
|
|
||||||
--------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: mitel_ommclient2.messages.open
|
.. automodule:: mitel_ommclient2.messages.open
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
mitel\_ommclient2.messages.ping module
|
|
||||||
--------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: mitel_ommclient2.messages.ping
|
.. automodule:: mitel_ommclient2.messages.ping
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
Module contents
|
|
||||||
---------------
|
|
||||||
|
|
||||||
.. automodule:: mitel_ommclient2.messages
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
@ -1,45 +0,0 @@
|
|||||||
mitel\_ommclient2 package
|
|
||||||
=========================
|
|
||||||
|
|
||||||
Subpackages
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 4
|
|
||||||
|
|
||||||
mitel_ommclient2.messages
|
|
||||||
|
|
||||||
Submodules
|
|
||||||
----------
|
|
||||||
|
|
||||||
mitel\_ommclient2.client module
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
.. automodule:: mitel_ommclient2.client
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
mitel\_ommclient2.connection module
|
|
||||||
-----------------------------------
|
|
||||||
|
|
||||||
.. automodule:: mitel_ommclient2.connection
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
mitel\_ommclient2.exceptions module
|
|
||||||
-----------------------------------
|
|
||||||
|
|
||||||
.. automodule:: mitel_ommclient2.exceptions
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
Module contents
|
|
||||||
---------------
|
|
||||||
|
|
||||||
.. automodule:: mitel_ommclient2
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
@ -14,7 +14,7 @@ This is the documentation for mitel_ommclient2. To get started stick to the :doc
|
|||||||
manual/client
|
manual/client
|
||||||
manual/connection
|
manual/connection
|
||||||
manual/messages
|
manual/messages
|
||||||
api/modules
|
api/index
|
||||||
|
|
||||||
Indices and tables
|
Indices and tables
|
||||||
==================
|
==================
|
||||||
|
@ -139,7 +139,7 @@ class OMMClient2:
|
|||||||
yield user
|
yield user
|
||||||
|
|
||||||
# Determine next possible ppn
|
# Determine next possible ppn
|
||||||
next_uid = int(user["uid"]) + 1
|
next_uid = int(user.uid) + 1
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
"""
|
"""
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
from xml.dom.minidom import getDOMImplementation, parseString
|
from xml.dom.minidom import getDOMImplementation, parseString
|
||||||
|
|
||||||
from ..exceptions import exception_classes, OMResponseException
|
from ..exceptions import exception_classes, OMResponseException
|
||||||
|
from ..types import cast_dict_to_childtype
|
||||||
|
|
||||||
|
|
||||||
class Message:
|
class Message:
|
||||||
@ -74,6 +75,9 @@ class Message:
|
|||||||
else:
|
else:
|
||||||
object.__setattr__(self, name, value)
|
object.__setattr__(self, name, value)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "{}({}, {}, {})".format(self.__class__.__name__, self.name, repr(self._attrs), repr(self._childs))
|
||||||
|
|
||||||
|
|
||||||
class Request(Message):
|
class Request(Message):
|
||||||
"""
|
"""
|
||||||
@ -179,6 +183,11 @@ def parse(message):
|
|||||||
new_child[item.name] = item.value
|
new_child[item.name] = item.value
|
||||||
|
|
||||||
childname = child.tagName
|
childname = child.tagName
|
||||||
|
|
||||||
|
# cast dict into child type
|
||||||
|
if response_type.CHILDS.get(childname) is not None:
|
||||||
|
new_child = cast_dict_to_childtype(response_type.CHILDS[childname], new_child)
|
||||||
|
|
||||||
if childname in childs:
|
if childname in childs:
|
||||||
childs[childname].append(new_child)
|
childs[childname].append(new_child)
|
||||||
else:
|
else:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from . import Request, Response, request_type, response_type
|
from . import Request, Response, request_type, response_type
|
||||||
|
from ..types import PPUserType
|
||||||
|
|
||||||
|
|
||||||
@request_type
|
@request_type
|
||||||
@ -14,5 +15,5 @@ class GetPPUser(Request):
|
|||||||
@response_type
|
@response_type
|
||||||
class GetPPUserResp(Response):
|
class GetPPUserResp(Response):
|
||||||
CHILDS = {
|
CHILDS = {
|
||||||
"user": None,
|
"user": PPUserType,
|
||||||
}
|
}
|
||||||
|
124
mitel_ommclient2/types/__init__.py
Normal file
124
mitel_ommclient2/types/__init__.py
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
class ChildType:
|
||||||
|
"""
|
||||||
|
Base type class
|
||||||
|
|
||||||
|
:param name: Name of the message
|
||||||
|
:param attrs: Message attributes
|
||||||
|
:param childs: Message children
|
||||||
|
"""
|
||||||
|
|
||||||
|
FIELDS = {}
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, attrs={}):
|
||||||
|
self._attrs = {}
|
||||||
|
|
||||||
|
for k, v in attrs.items():
|
||||||
|
setattr(self, k, v)
|
||||||
|
|
||||||
|
def __getattr__(self, name):
|
||||||
|
if name in self.FIELDS.keys():
|
||||||
|
return self._attrs.get(name)
|
||||||
|
else:
|
||||||
|
raise AttributeError()
|
||||||
|
|
||||||
|
def __setattr__(self, name, value):
|
||||||
|
if name in self.FIELDS.keys():
|
||||||
|
if self.FIELDS[name] is not None and type(value) != self.FIELDS[name]:
|
||||||
|
raise TypeError()
|
||||||
|
self._attrs[name] = value
|
||||||
|
else:
|
||||||
|
object.__setattr__(self, name, value)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "{}({})".format(self.__class__.__name__, repr(self._attrs))
|
||||||
|
|
||||||
|
def cast_dict_to_childtype(t, d):
|
||||||
|
for k, v in d.items():
|
||||||
|
if k in t.FIELDS.keys():
|
||||||
|
if t.FIELDS[k] is not None and type(v) != t.FIELDS[k]:
|
||||||
|
d[k] = t.FIELDS[k](v)
|
||||||
|
else:
|
||||||
|
raise KeyError()
|
||||||
|
|
||||||
|
return t(d)
|
||||||
|
|
||||||
|
class PPUserType(ChildType):
|
||||||
|
FIELDS = {
|
||||||
|
"uid": int,
|
||||||
|
"timeStamp": int,
|
||||||
|
"relType": None, #PPRelTypeType,
|
||||||
|
"ppn": int,
|
||||||
|
"name": str,
|
||||||
|
"num": str,
|
||||||
|
"hierarchy1": str,
|
||||||
|
"hierarchy2": str,
|
||||||
|
"addId": str,
|
||||||
|
"pin": str,
|
||||||
|
"sipAuthId": str,
|
||||||
|
"sipPw": str,
|
||||||
|
"sosNum": str,
|
||||||
|
"voiceboxNum": str,
|
||||||
|
"manDownNum": str,
|
||||||
|
"forwardStateCall": None, #ForwardStateType,
|
||||||
|
"forwardTime": int,
|
||||||
|
"forwardDest": str,
|
||||||
|
"langPP": None, #LanguageType,
|
||||||
|
"holdRingBackTime": int,
|
||||||
|
"autoAnswer": str,
|
||||||
|
"microphoneMute": str,
|
||||||
|
"warningTone": str,
|
||||||
|
"allowBargeIn": str,
|
||||||
|
"callWaitingDisabled": bool,
|
||||||
|
"external": bool,
|
||||||
|
"trackingActive": bool,
|
||||||
|
"locatable": bool,
|
||||||
|
"BTlocatable": bool,
|
||||||
|
"BTsensitivity": str,
|
||||||
|
"locRight": bool,
|
||||||
|
"msgRight": bool,
|
||||||
|
"sendVcardRight": bool,
|
||||||
|
"recvVcardRight": bool,
|
||||||
|
"keepLocalPB": bool,
|
||||||
|
"vip": bool,
|
||||||
|
"sipRegisterCheck": bool,
|
||||||
|
"allowVideoStream": bool,
|
||||||
|
"conferenceServerType": str,
|
||||||
|
"conferenceServerURI": str,
|
||||||
|
"monitoringMode": str,
|
||||||
|
"CUS": None, #MonitoringStateType,
|
||||||
|
"HAS": None, #MonitoringStateType,
|
||||||
|
"HSS": None, #MonitoringStateType,
|
||||||
|
"HRS": None, #MonitoringStateType,
|
||||||
|
"HCS": None, #MonitoringStateType,
|
||||||
|
"SRS": None, #MonitoringStateType,
|
||||||
|
"SCS": None, #MonitoringStateType,
|
||||||
|
"CDS": None, #MonitoringStateType,
|
||||||
|
"HBS": None, #MonitoringStateType,
|
||||||
|
"BTS": None, #MonitoringStateType,
|
||||||
|
"SWS": None, #MonitoringStateType,
|
||||||
|
"credentialPw": str,
|
||||||
|
"configurationDataLoaded": bool,
|
||||||
|
"ppData": str,
|
||||||
|
"ppProfileId": int,
|
||||||
|
"fixedSipPort": int,
|
||||||
|
"calculatedSipPort": int,
|
||||||
|
# undocumented
|
||||||
|
"uidSec": int,
|
||||||
|
"permanent": bool,
|
||||||
|
"lang": None,
|
||||||
|
"forwardState": None,
|
||||||
|
"autoLogoutOnCharge": bool,
|
||||||
|
"hotDeskingSupport": bool,
|
||||||
|
"authenticateLogout": bool,
|
||||||
|
"useSIPUserName": None,
|
||||||
|
"useSIPUserAuthentication": None,
|
||||||
|
"serviceUserName": None,
|
||||||
|
"serviceAuthName": None,
|
||||||
|
"serviceAuthPassword": None,
|
||||||
|
"keyLockEnable": None,
|
||||||
|
"keyLockPin": None,
|
||||||
|
"keyLockTime": None,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user