OMMClient package¶
Submodules¶
OMMClient.OMMClient module¶
-
class
OMMClient.OMMClient.OMMClient(host, port=12622)[source]¶ Bases:
events.events.Events-
attach_user_device(uid, ppn)[source]¶ Connects an existing user profile to an existing subscribed device
- Args:
- uid (int): user profile id ppn (int): registered device id
- Returns:
- True if the operation was successful. False if it failed.
-
create_user(name, number, desc1=None, desc2=None, login=None, pin='', sip_user=None, sip_password=None)[source]¶ Creates new user
This function will create a new user profile without a device relation ship in dynamic mode. It can be used to loing from a device using the feature access code with login and PIN specified. The Feature access code can be configured using OMM. Could be someting like (*1)(4711)(3333). Within the example *1 stands for general feature access prefix 4711 is the code for user login. And 3333 is the extension for which login is requested. User will be prompted for a PIN.
Note
If no sip user name and sip password is specified number will be used
Parameters: - name (str) – Name for the user profile (Shown as Name in OMP)
- number (str) – number for the user profile (Shown as Number/SIP user name in OMM)
- desc1 (str) – Description 1 for the new user profile. Can by any string.
- desc2 (str) – Description 2 for the new user profile. Can by any string.
- login (str) – Login for the use to be used for profile login from DECT or additional ID.
- pin (str) – PIN for profile login via DECT. Any non numeric value doesn’t make sense.
- sip_user (str) – Username for OMM to register the profile against the configured sip registrar
- sip_password (str) – Password for sip register against registrar configured
Return type: dict
Returns: Will return a dict containing data of the new user object if successful. Will return None if it failed.
-
delete_device(ppid)[source]¶ Delete a configured handset (pp)
Note
This operation can not be undone!
Parameters: ppid (int) – id of the PP to be deleted (>0) Returns: None
-
detach_user_device(uid, ppn)[source]¶ detaches an user profile from an existing device
Note
You have to obtain the device id also named ppn and the users id named uid.
Can be used to logout a user profile from a device entry. The user can be logged in to another device after that. The device can be used to login another user.
- Args:
- uid (int): user profile id ppn (int): registered device id
- Returns:
- True if the operation was successful. False if it failed.
-
get_device(ppn)[source]¶ get device configuration data
- Args:
param ppn: device id inside OMM type ppn: int - Returns:
rtype: OMMDevice returns: Device object if successful None if not
-
get_device_state(ppn)[source]¶ Fetches the current state of a PP
- Args:
param ppn: id of the PP to get the current state for type ppn: int - Returns:
return: A dict containing the devices state information
-
get_limits()[source]¶ Fetches maximum Numbers for RFPs, users ect.
- Returns:
- A dict containing all limitations for the different types.
-
get_user(uid)[source]¶ get user configuration data
Obtain the user profiles configuration data like sip-login ect. using the user id.
- Args:
- uid (int): user profile id
- Returns:
- Will return the users profile if the request ist successful. If it fails None will be returned.
-
get_versions()[source]¶ Fetches the OMM supported protocol versions for all calls.
- Returns:
- A dict containing protocol versions for all available calls.
-
login(user, password, ommsync=False)[source]¶ login to OMM with given credentials
Method used to login before executing any command except get_versions against the OMM. The login can be performed in two modes to support different sets of features. The normal OMPClient login is restricted to all operations which can be performed using the OMP client application. Using the OMM sync flag you will be able to perform further operations. These operations are:
- Attach user profile to device (Login)
- Detach user profile from device (Logout)
- Write extended device information (read only in OMP)
Note
Some operations in OMM-Sync mode might lead to destroy DECT paring.
- Args:
- user (str): Username to be used to login password (str): Password to be used to login ommsync (bool): If True login as OMM-Sync client
-
logout()[source]¶ Logout from OMM
Calling this method will log you out and close the underlying tcp/ssl socket. Login can be called any time to reuse the client object for further calls.
-
omm_status= {}¶
-
omm_versions= {}¶
-
set_subscription(mode, timeout=None)[source]¶ Set DECT Subscription Mode (Modes are: off, configured, wildcard)
- Args:
- mode (str): one of the following Modes:
- off
- configured
- wildcard
- timeout (int): The time after that the wildcard mode disables.
- It is only required if switching to wildcard mode.
- Returns:
- True: if parameters are ok False: if the parameters are faulty
-
set_user_pin(uid, pin)[source]¶ rest a user profiles PIN
Resets the PIN a user uses to login his user profile into a DECT device. That can be done by using the defined system feature code, the profiles login and this PIN.
- Args:
- uid (int): user profile id pin (str): PIN to set
- Returns:
- True: if successful False: if the request failed
-
set_user_relation_dynamic(uid)[source]¶ Convert a fixed device-user relation into a dynamic one
After converting the relation from fixed to dynamic users are able to logout the profile from a device using the DECT feature code.
- Args:
- uid (int): user profile id
- Returns:
- Will return the user profile’s attributes if successful False will be returned if the request failed.
-
set_user_relation_fixed(uid)[source]¶ Convert a user-device relation into fixed type
Note
Prior to this operation the user profile must be bound to a device.
When a user profile is already logged in (bound) to a device using dynamic relationship this method can be used to fix the binding. After that no login and logout method can be performed using the DECT mechanisms.
- Args:
- uid (int): user profile id
- Returns:
- If successful it will return a dict containing all information about the user profile. Will return False if the request didn’t succeed properly.
-