mitel_ommclient2.client module

class mitel_ommclient2.client.OMMClient2(host, username, password, port=None, ommsync=False)

Bases: object

High level wrapper for the OM Application XML Interface

This class tries to provide functions for often used methods without the need of using the underlying messaging protocol

Parameters:
  • host – Hostname or IP address of the OMM

  • username – Username

  • password – Password

  • port – Port where to access the API, if None, use default value

  • ommsync – If True login as OMM-Sync client. Some operations in OMM-Sync mode might lead to destroy DECT paring.

Usage:

>>> c = OMMClient2("omm.local", "admin", "admin")
>>> c.ping()

Use request to send custom messages:

>>> r = s.connection.request(mitel_ommclient2.messages.Ping())
attach_user_device(uid, ppn)

Attach user to device

Parameters:
  • uid – User id

  • ppn – Device id

Requires ommsync=True

create_user(num)

Create PP user

Parameters:

num – User number

detach_user_device(uid, ppn)

Detach user from device

Parameters:
  • uid – User id

  • ppn – Device id

Requires ommsync=True

detach_user_device_by_device(ppn)

Detach user from device

This just requires the device id

Parameters:

ppn – Device id

Requires ommsync=True

detach_user_device_by_user(uid)

Detach user from device

This just requires the user id

Parameters:

uid – User id

Requires ommsync=True

encrypt(secret)

Encrypt secret for OMM

Required rsa module to be installed

Parameters:

secret – String to encrypt

find_devices(filter)

Get all devices matching a filter

Parameters:

filter – function taking one parameter which is a device, returns True to keep, False to discard

Usage:

>>> c.find_devices(lambda d: d.relType == mitel_ommclient2.types.PPRelTypeType("Unbound"))
find_users(filter)

Get all users matching a filter

Parameters:

filter – function taking one parameter which is a user, returns True to keep, False to discard

Usage:

>>> c.find_users(lambda u: u.num.startswith("9998"))
get_account(id)

Get account

Parameters:

id – User id

get_device(ppn)

Get PP device

Parameters:

ppn – Device id

get_devices()

Get all PP devices

get_publickey()

Get public key for encrypted values

get_user(uid)

Get PP user

Parameters:

uid – User id

get_users()

Get all PP users

ping()

Is OMM still there?

Returns True when response is received.

set_user_name(uid, name)

Set PP user name

Parameters:
  • uid – User id

  • name – User name

set_user_num(uid, num)

Set PP user number

Parameters:
  • uid – User id

  • num – User number

set_user_relation_dynamic(uid)

Set PP user to PP device relation to dynamic type

Parameters:

uid – User id

set_user_relation_fixed(uid)

Set PP user to PP device relation to fixed type

Parameters:

uid – User id

set_user_sipauth(uid, sipAuthId, sipPw)

Set PP user sip credentials

Parameters:
  • uid – User id

  • sipAuthId – SIP user name

  • sipPw – Plain text password