Esempio n. 1
0
 def calls_contexts_stats(self, request):
     api_log.info('%s - [GET] %s/calls/contexts',
                  request.getHost().host, self.path)
     try:
         stats = CallsStatistics()
         data = json.dumps(stats.get_contexts_stats(), cls=PGEncoder)
     except StatisticException as e:
         data = {'status': 'failed', 'error': str(e)}
     return data
Esempio n. 2
0
 def calls(self, request, period):
     api_log.info('%s - [POST] %s/calls/calls Data: period:"%s"',
                  request.getHost().host, self.path, period)
     try:
         stats = CallsStatistics()
         data = json.dumps(stats.get_calls_stats(period), cls=PGEncoder)
     except StatisticException as e:
         data = {'status': 'failed', 'error': str(e)}
     api_log.info(data)
     return data
Esempio n. 3
0
 def average_call_duration(self, request):
     api_log.info('%s - [GET] %s/calls/average_call_duration',
                  request.getHost().host, self.path)
     try:
         stats = CallsStatistics()
         data = json.dumps(stats.get_average_call_duration(), cls=PGEncoder)
     except StatisticException as e:
         data = {'status': 'failed', 'error': str(e)}
     api_log.info(data)
     return data
Esempio n. 4
0
 def total_minutes(self, request):
     api_log.info('%s - [GET] %s/calls/total_minutes',
                  request.getHost().host, self.path)
     try:
         stats = CallsStatistics()
         data = stats.get_total_minutes()
     except StatisticException as e:
         data = {'status': 'failed', 'error': str(e)}
     api_log.info(data)
     return str(data)
Esempio n. 5
0
 def get_sms_stat(self, request, year, month):
     api_log.info('%s - [GET] %s/calls/obm',
                  request.getHost().host, self.path)
     try:
         stats = CallsStatistics()
         data = json.dumps(stats.get_sms_stat(year, month), cls=PGEncoder)
     except StatisticException as e:
         data = {'status': 'failed', 'error': str(e)}
     api_log.debug(data)
     return str(data)
Esempio n. 6
0
 def total_calls_by_context(self, request, context):
     api_log.info(
         '%s - [POST] %s/calls/total_calls_by_context Data: context:"%s"',
         request.getHost().host, self.path, context)
     try:
         stats = CallsStatistics()
         data = stats.get_total_calls_by_context(context)
     except StatisticException as e:
         data = {'status': 'failed', 'error': str(e)}
     api_log.info(data)
     return data