Reference13r1:Concept App Service Reports: Difference between revisions

From innovaphone wiki
Jump to navigation Jump to search
Line 76: Line 76:
You can find the documentation for this file here: https://www.postgresql.org/docs/11/auth-pg-hba-conf.html<br>
You can find the documentation for this file here: https://www.postgresql.org/docs/11/auth-pg-hba-conf.html<br>
<br>
<br>
The user admin is not allowed to accesss pg_hba.conf. You have to use the root user. Access with the root user is described [http://wiki.innovaphone.com/index.php?title=Reference13r1:Concept_App_Platform#Default_credentials here].<br>
The user admin is not allowed to access pg_hba.conf. You have to use the root user. Access with the root user is described [http://wiki.innovaphone.com/index.php?title=Reference13r1:Concept_App_Platform#Default_credentials here].<br>
<br>
<br>
After editing pg_hba.conf, the database-service has to be restarted with this command:<br>
After editing pg_hba.conf, the database-service has to be restarted with this command:<br>
/etc/init.d/S50postgresql restart  
/etc/init.d/S50postgresql restart  
<br>
<br><br>
The database user and password can be configured for every Reporting instance inside the AP Manager if you edit the instance.<br>
The database user and password can be configured for every Reporting instance inside the AP Manager if you edit the instance.<br>
These database credentials are just used internally and not e.g. inside the PBX App Objects.
These database credentials are just used internally and not e.g. inside the PBX App Objects.

Revision as of 12:00, 27 May 2020


The App Service Reporting is an App Service which can be installed on an innovaphone App Platform. It is used to provide call lists in myApps or myPBX and to create call reports.

Applies To

  • innovaphone PBX from version 13r1

Technical Overview

Concept reporting.png

Apps

innovaphone-reporting

This is the Reporting UI App.

innovaphone-calllist

This is the Call list App.

Parameters:

Websocket

innovaphone-calllist-api

This is an App, which provides the Call list API (com.innovaphone.calllist). This API can be used to find the recent calls of a user.

Parameters:

Websocket

mypbx

This is the interface for the support of the old myPBX client.

PBX Manager Plugins

Reporting

With the Reporting plugin App objects can be created, edited and deleted for the provided Apps.

Configuration

There is also a configuration to enable compatibility for myPBX call lists in the AP-Reporting Plugin in the PBXManager. You have also to configure the new created account in the MyPBX configuration.

Concepts

Database Structure

cdrs

Each received cdr-xml is formed by a cdr tag and an undefined number of event and group tags. (Refer to: CDR)

This section is composed by four tables: cdrs, events, groups and cdr_properties. The first three tables contain the corresponding fields to store the information contained in the cdr, event and group tags.
Each CDR represents the call in the view of one PBX object. So there might be multiple CDRs for one call if multiple PBX objects are used within the call.

  • cdr fields: id, guid, user_guid, conf, sys, pbx, node, phys, device, h323, e164, cn, dn, email, dir, external, licensed, more_calls, conn_duration, alert_duration, call_duration, billing_duration, utc_stamp, cause, remote_e164, remote_h323, remote_dn, call_list, missed_call, status, further, user_id, callback_e164, callback_h323, callback_dn, callback_time, remote_clir
  • event fields: id, cdr_id, msg, ext, e164, h323, dn, conf, cause, time, clir
  • group fields: id, name, active, type, cdr_id.

id field is assigned by postgresql for each entry and has nothing to do with the information present in the cdr. It is different for each entry inside the table.

The events table has two additional fields, called cdr_id, to associate these events to the corresponding cdr entry and order_index to keep their position inside the cdr. Groups table has also the cdr_id field to associate the group entries to the corresponding cdr and events entries.

The table cdrp_properties from version 10 has been removed. Most columns can be now found directly in the table cdrs.
If you need the callflow in a similar way, you can JOIN the events table (GROUP BY cdr_id) and run a query which creates an array string from the events table:

array_agg(array[ev.msg, COALESCE(ev.e164,), COALESCE(ev.h323,), COALESCE(ev.dn,)] ORDER BY ev.id) AS callflow

cdr_users

This table contains a timestamp missed_calls_time for the last call list access by a user sip. It is used to retrieve information about missed calls since the last use of mypbx/myApps.
The timestamp clear_report_time indicates the last clearance time.

Database access

You have to manually grant access to the reporting database, e.g. for specific IP addresses, inside the file /mnt/sda2/pgsql/pg_hba.conf, as the default configuration doesn't allow access from external.
You can find the documentation for this file here: https://www.postgresql.org/docs/11/auth-pg-hba-conf.html

The user admin is not allowed to access pg_hba.conf. You have to use the root user. Access with the root user is described here.

After editing pg_hba.conf, the database-service has to be restarted with this command:
/etc/init.d/S50postgresql restart

The database user and password can be configured for every Reporting instance inside the AP Manager if you edit the instance.
These database credentials are just used internally and not e.g. inside the PBX App Objects.

Write an own app

Currently there can be two ways for an own App:

  • You receive the CDRs from the CDR interfaces yourself and store them into your own database with your own structure.
  • You hand the Reporting database credentials to your own App and connect directly to the Reporting database within your own App. This saves you the parsing and storing of the data, but you must maintain your queries if something in the Reporting database is changed. It is important, that you should just access this data readonly and that you do not modify table data!


Example for automatic download of existing CSV files:

  1. establish a web socket connection for reporting using PHP-access
  2. request the session key with { "mt": "Start" }
  3. receive the session key which e.g. looks like {"mt": "StartResult", "session": "189", "key": "552ca6fe05a19"}
  4. while the web socket connection is established, a GET request using received data can be sent like this:
    • http://AP-IP/DOMAIN/reporting/reports/report-20200408-1015.csv?session=189&key=552ca6fe05a19&lang=de&tz=Europe/Berlin&type=csv&sip=&from=1586304000000&to=1586333749607

Appendix