Add some additional APIs

This commit is contained in:
Maff 2019-05-17 22:15:41 +01:00
parent dfb01060cc
commit 90fe289a1d
1 changed files with 53 additions and 0 deletions

View File

@ -116,6 +116,59 @@ class Extension(ReadOnlyObject):
self.cli=res['OutboundCallerId']
self.mobile=res['MobileNumber']
self.online=res['IsRegistered']
class PhoneSystem:
class System(object):
class License(object):
pass
class Status(object):
pass
def __init__(self, tcx):
self.tcx=tcx
def refresh_sysstat(self):
sysstat=self.tcx.rq.get('SystemStatus').json()
addl=self.tcx.rq.get('SystemStatus/AdditionalStatus').json()
inroute=self.tcx.rq.get('InboundRulesList').json()['list']
hists=self.tcx.rq.post('SystemStatus/getDbInformation').json()
certstat=self.tcx.rq.get('SystemStatus/GetSingleStatus').json()
self.Status.exts_online=sysstat['ExtensionsRegistered']
self.Status.trunks_online=sysstat['TrunksRegistered']
self.Status.calls_active=sysstat['CallsActive']
self.Status.callrecs_bytes=addl['RecordingUsedSpace']
self.Status.diskbytes_free=sysstat['FreeDiskSpace']
self.Status.membytes_free=sysstat['FreePhysicalMemory']
self.Status.banned_ips=sysstat['BlacklistedIpCount']
self.Status.last_backup=sysstat['LastBackupDateTime']
self.Status.sysexts_online=not sysstat['HasUnregisteredSystemExtensions']
self.Status.services_online=not sysstat['HasNotRunningServices']
self.System.routes_out=sysstat['OutboundRules']
self.System.routes_in=len(inroute)
self.System.fqdn=sysstat['FQDN']
self.System.webconf=sysstat['WebMeetingFQDN']
self.System.version=sysstat['Version']
self.System.diskbytes_total=sysstat['TotalDiskSpace']
self.System.membytes_total=sysstat['TotalPhysicalMemory']
self.System.calls_total=hists['CallHistoryCount']
self.System.chats_total=hists['ChatMessagesCount']
self.System.callrecs_enabled=not addl['RecordingStopped']
self.System.callrecs_quota=addl['RecordingQuota']
self.System.exts_total=sysstat['ExtensionsTotal']
self.System.trunks_total=sysstat['TrunksTotal']
self.System.firebase_confed=sysstat['OwnPush']
self.System.backups_enabled=sysstat['BackupScheduled']
self.System.License.firewallsupported=certstat['Health']['Firewall']
self.System.License.trunkssupported=certstat['Health']['Trunks']
self.System.License.phonessupported=certstat['Health']['Phones']
self.System.License.activated=sysstat['Activated']
self.System.License.calls=sysstat['MaxSimCalls']
self.System.License.meetingcalls=sysstat['MaxSimMeetingParticipants']
self.System.License.supported=sysstat['Support']
self.System.License.expire=sysstat['ExpirationDate']
self.System.License.maintexpire=sysstat['MaintenanceExpiresAt']
self.System.License.reseller=sysstat['ResellerName']
self.System.License.key=sysstat['LicenseKey']
self.System.License.sku=sysstat['ProductCode']
self.System.License.spla=sysstat['IsSpla']
class Py3CX:
def __init__(self, uri=None, tls_verify=True):