Manual for installing version 1.3.X on the FreePBX Distro 16 (SNG7-PBX16-64bit)
Table of contents:
2. Installing the basic Pbxunit system and the "Call Records" report
3. Installing the "Auto-call" module
4. Installing the "Automatic Polls" module
5. Installing the "Text to speech" module
0. Installation security
After installation, change the admin user password in the pbxunit web interface.
1. System Requirements
ОС: Linux (Python 3.X, MySQL or MariaDB database, web-server Apache and PHP7)
FreePBX modules must be installed: Recordings, IVR, Queues
Tested on: FreePBX v14, FreePBX v15, FreePBX v16
Tested on distributions: FreePBX Distro SNG7-PBX16-64bit
2. Installing the basic Pbxunit system and the "Call Records" report
Install the OS distribution FreePBX Distro SNG7-PBX16-64bit: https://www.freepbx.org/downloads/
During OS installation, the system will ask you to enter the root password. Remember it.
Perform basic FreePBX setup, start trunks and at least 1 route for outgoing communication.
Login into the server OS command shell as the root user.
Change to your home directory and create a directory for the installation files:
cd ~
mkdir src
cd src
Download the archive with the latest version of Pbxunit for PHP 7.
wget https://pbxunit.com/downloads/pbxunit-php7-en-last.tar.gz
Unzip the archive:
tar xvf pbxunit-php7-en-last.tar.gz
Extract the archive: Find out the password from the MySQL database user - freepbxuser.
You can view the username and password in the freepbx configuration file:
cat /etc/freepbx.conf
The password is contained in a variable $amp_conf['AMPDBPASS']
Navigate to the database directory from the unpacked archive. Enter the command to import tables into the asterisk database:
cd ~/src/pbxunit/database
mysql -u freepbxuser -p -D asterisk < asterisk.sql
Enter the database password for the freepbxuser user.
To speed up reports, it is desirable to add the missing indexes to the cdr table for the asteriskcdrdb database. Attention - if your system already contains a large amount of statistics in the cdr table, adding indexes can lock the table for a long time, run the command with the Asterisk service stopped.
Enter the command to create indexes in the asteriskcdrdb database:
mysql -u freepbxuser -p -D asteriskcdrdb < asteriskcdrdb_indexes.sql
Enter the database password for the freepbxuser user.
Navigate to the web directory from the unpacked archive. Copy the pbxunit directory to the web server directory:
cd ~/src/pbxunit/web
cp -r pbxunit/ /var/www/html/
Edit the Pbxunit configuration file:
nano /var/www/html/pbxunit/config.php
Enter password from user freebxuser, MySQL database:
For asterisk database, example:
$_AST_CONFIG['DBPass'] = 'db password for freepbxuser';
For asteriskcdrdb database, example:
$_AST_CONFIG['DBPassCDR'] = 'db password for freepbxuser';
The password for the freepbxuser database user can be found in the FreePBX configuration file:
cat /etc/freepbx.conf
Run the command to change script permissions:
fwconsole chown
Full description of the configuration file: Web-interface configuration file
Now you can log in under the Administrator account to the web interface at:
http://<server IP-address>/pbxunit/
Default login: admin password: pbxunit
In "Administration -> Modules and licenses -> Edit company name" enter your company name and save.
3. Installing the "Auto-call" module
Run the command to create a symbolic link for Python 3:
ln -s /bin/python3.6 /bin/python3
Install the MySQL Python library:
yum install python36u-pymysql
Install the pip package manager:
yum install python36u-pip
Update pip:
pip3.6 install --upgrade pip
Install the pyst library for Python:
pip3.6 install pyst
Change to the Pbxunit installation directory:
cd ~/src/pbxunit
Copy the directory with the configuration file to the directory /etc:
cp -r configs/pbxunit /etc/
The password for the freepbxuser database user can be found in the FreePBX configuration file:
cat /etc/freepbx.conf
Find out the admin user password for the Asterisk Manager Interface, you can see it in the /etc/asterisk/manager.conf config:
cat /etc/asterisk/manager.conf
The password is in the [admin] section, the "secret" parameter.
Edit the config file:
nano /etc/pbxunit/pbxunit.conf
In the [mysql] section, enter the MySQL user password freepbxuser, for example:
db_user=freepbxuser
db_pass=freepbxuser DB user password
In the [ami] section, enter the details from the admin user for the Asterisk Manager Interface:
user=admin
pass=ami user password
In the [path] section, specify the path for the directory with sound files along with the language code, for example, for English:
sounds=/var/lib/asterisk/sounds/en
The selected language must be downloaded in FreePBX, you can check it in the Admin -> Sound Languages tab in FreePBX
Full description of the configuration file: Service configuration file
Copy the Python libraries to your version's python libraries directory:
cp -r python-lib/pbxunit/ /usr/lib/python3.6/site-packages/
Change to the modules/autocall/ directory from the installation archive:
cd ~/src/pbxunit/modules/autocall
Enter the command for additional fields in the cdr table from the asteriskcdrdb database:
Attention - if your system already contains a large amount of statistics in the cdr table, adding indexes can lock the table for a long time, run the command with the Asterisk service stopped.
mysql -u freepbxuser -p -D asteriskcdrdb < database/asteriskcdrdb.sql
Enter the database password for the freepbxuser user.
Copy the files from the modules/autocall/agi-bin directory to the Asterisk agi-bin directory:
cp agi-bin/* /var/lib/asterisk/agi-bin/
Copy the service startup files from modules/init.d to the /etc/init.d directory:
cp init.d/* /etc/init.d/
Make the files executable:
chmod a+x /etc/init.d/pbxu_*
Add the contents of the dialplan/extensions_custom.conf file to /etc/asterisk/extensions_custom.conf
cat dialplan/extensions_custom.conf >> /etc/asterisk/extensions_custom.conf
If necessary, edit the /etc/asterisk/extensions_custom.conf config. In the [pbxu-autocall-dial] section, change the language of the channel to the required one, for example:
exten => _.,n,Set(CHANNEL(language)=en)
If you need disable recording CDR. In the [macro-pbxu-autocall] section, you can disable recording CDR statistics during auto-call, to do this, uncomment the line:
#exten => s,n,NoCDR()
When recording in CDR is disabled, the Duration field will not be displayed in reports.
Reload the Asterisk dial plan:
asterisk -x 'dialplan reload'
Add services to startup.
Option 1:
ln -s /etc/init.d/pbxu_start_autocall.py /etc/rc3.d/K01pbxu_start_autocall.py
ln -s /etc/init.d/pbxu_queue_autocall.py /etc/rc3.d/K01pbxu_queue_autocall.py
ln -s /etc/init.d/pbxu_start_autocall.py /etc/rc3.d/S99pbxu_start_autocall.py
ln -s /etc/init.d/pbxu_queue_autocall.py /etc/rc3.d/S99pbxu_queue_autocall.py
Option 2 (there were problems in the latest builds of FreePBX Distro):
nano /etc/rc.local
Add lines:
/etc/init.d/pbxu_queue_autocall.py restart
/etc/init.d/pbxu_start_autocall.py restart
Set execute permissions for rc.local:
chmod a+x /etc/rc.d/rc.local
Run the command to change script permissions:
fwconsole chown
Start services:
/etc/init.d/pbxu_queue_autocall.py start
/etc/init.d/pbxu_start_autocall.py start
To import large job files, you may need to edit the php.ini file on your OS.
Edit the file:
nano /etc/php.ini
Increase the data upload limit, for example, up to 50 MB. Find and edit the post_max_size variable in /etc/php.ini
post_max_size = 50M
After changes in php.ini - restart the web server:
service httpd restart
4. Installing the "Automatic Polls" module
You must first have the "Auto-call" module installed.
Change to the modules/autopolls/ directory from the installation archive:
cd ~/src/pbxunit/modules/autopolls
Copy the files from the autopolls/agi-bin directory to the Asterisk agi-bin directory:
cp agi-bin/* /var/lib/asterisk/agi-bin/
Copy the contents of the dialplan/extensions_custom.conf file to /etc/asterisk/extensions_custom.conf
cat dialplan/extensions_custom.conf >> /etc/asterisk/extensions_custom.conf
Reload the Asterisk dial plan:
asterisk -x 'dialplan reload'
Run the command to change script permissions:
fwconsole chown
5. Installing the "Text to speech" module
Amazon Polly
Install the boto3 python library for Amazon Polly to work:
pip3.6 install boto3
Yandex Cloud Speechkit
Install the requests library:
pip3.6 install requests
Install the package for converting from ogg format for Yandex Cloud Speechkit:
The utility from it should be located along the path: /usr/bin/avconv
For the 64-bit FreePBX Distro 16 distribution, you can copy the compiled file from the pbxunit distribution:
cd ~/src/pbxunit/
cp opt/x86_64/avconv /usr/bin/
chmod a+x /usr/bin/avconv