Interaction of Tariscope with 3CX v20
This article is intended for users of Tariscope Enterprise or Tariscope Provider licenses, with the restriction function used to manage the 3CX v20.
Starting with Tariscope 4.7, a new script has been developed for the Tariscope Observer application, which transmits commands to restrict subscribers or remove these restrictions to a separate TSconnector application. This application is installed on the server with 3CX v20, and it directly sends commands to this PBX. There are separate applications for Windows and Linux, depending on which operating system 3CX runs on. The diagram of the interaction of the Tariscope billing system (call accounting system) with 3CX is shown in Figure 1.
Figure 1
All settings of the restriction system in Tariscope are performed as before, except for selecting a script and installing the TSconnector application.
Download the appropriate application from the Tariscope website:
for Windows (tsconnector.zip) or Linux (tsconnector.tar.gz), depending on which operating system you have 3CX installed on.
For the TSconnector application to work, you need a configuration file from 3CX: 3CXPhoneSystem.ini
On Windows, this file should be in the folder: C:\ProgramData\3CX\Bin
On Linux, this file should be in the directory: /var/lib/3cxpbx/Bin/
You also need to allow access from other computers to the PostgreSQL server where the 3CX database is installed. Tariscope and TSconnector do not work with the 3CX database, but use their own database.
To do this, you need to make changes to the pg_hba.conf file.
On Windows, this file should be in the folder: C:\ProgramData\3CX\Data\DB
On Linux, this file should be in the directory: var/lib/postgresql/<version>/main/
Add new lines to allow access from other IP addresses.
For example, to allow connections from any IP address:
host all all 0.0.0.0/0 password
To allow from a specific IP address, for example, 192.168.1.100, where Tariscope is installed:
host all all 192.168.1.100/32 password
Installing the application for Windows
Unzip the tsconnector.zip archive to a folder, for example: C:\TSconnector
Copy the 3CXPhoneSystem.ini file to this folder.
TSconnector performs actions to set or remove restrictions, depending on what commands it receives from Tariscope, with a period specified in the config.json file in seconds. By default, this period is 30 seconds. If necessary, open this file and change the period.
Open Command Prompt with administrator rights.
Create a Windows service with the following command:
sc create TSconnector binpath= [шлях до файлу tsconnector.exe]
For example, if you unzipped the archive to the C:\TSconnector folder, this command should look like this:
sc create TSconnector binpath= C:\TSconnector\ tsconnector.exe
Start this service with the following command:
sc start TSconnector
If the service starts successfully, the TS_restrictions.log file will be created in this folder. Check its contents to make sure it does not contain any errors.
Installing the application for Linux
Unzip the tsconnector.tar.gz archive to a directory, for example: /home/softpi/TSconnector (softpi here is the username you logged in to the system with).
Copy the 3CXPhoneSystem.ini file to this directory.
Create a unit file for the Linux service, for example, with the name ts-connector.service
This file should contain the following lines:
[Unit]
Description=Tariscope restrictions
[Service]
Type=notify
ExecStart=/home/softpi/TSconnector/TSconnector
[Install]
WantedBy=multi-user.target
Comments on the file content:
Description can be arbitrary.
ExecStart is a path to the TSconnector file from the archive.
Copy this file to the /etc/system/system directory:
sudo cp /home/softpi/TSconnector/ts-connector.service /etc/system/system
Restart Linux services. Please note that all services will be restarted, including 3CX services. Therefore, choose the appropriate time for this.
sudo systemctl daemon-reload
Check the status of the ts-connector daemon (if you create a unit file for the service with a different name, use that name in the next command):
sudo systemctl status ts-connector
If the service is inactive, start it.
sudo systemctl start ts-connector
If everything is done correctly, the status should be "active". In this case, a service log will be created. The service log of TS_restrictions.log will be in the directory where you unpacked the archive.
Configuring the Tariscope script
In Tariscope, select Data Collection/Observer -> Observer management.
On the Data Collection/Observer page, select the row from the Observer that works with 3CX v20.
On the toolbar, click the Edit icon and select Observer Scripts.
In the Event list, select the required one, for example, Change class of service, which meets the terms of the Tariscope license.
In the Script list, select: setcos-subscriber-3cx-v20.cs
Click the Edit icon. The Edit window will appear where the script text will be displayed. Find the following lines there and make the appropriate changes:
const string DBHost = "127.0.0.1"; //IP address of PostgreSQL server
const string DBPort = "5432"; //IP port of PostgreSQL server
const string MasterDBUser = "phonesystem"; //Database username
const string MasterDBPassword = "pLvjPg8IKUo"; //Database username password
For the DBhost constant, specify the IP address where 3CX is installed.
For the next 3 script constants, replace the values with those used in the 3CXPhoneSystem.ini file in the CfgServerProfile section.
Save the changes in the script.
After that, if all other settings for the restriction system in Tariscope are made, you can run Observer.