Quick start: a ready-made script

To use QueueMetrics Live with FusionPBX, it is necessary to install and configure some system services. These are described in detail in Appendix I, should you wish to perform a manual installation. However, the recommended method for creating and managing the integration is to use a self-contained script provided by Loway.

This script takes care of:

  • Installing and optionally updating the required components, including the qm-fsw-ctl helper script.

  • Configuring them correctly and starting or restarting them if the configuration changes

  • Checking that the parameters are correct, for example, the instance or database credentials

The script works with both Debian and Rocky/CentOS/Red Hat, and in the simplest case, installs everything on the same machine where the PBX is located.

The script can be run through Ansible 2+

First Installation

For the system to function, it is necessary to have at least one instance to which the data will be loaded and one tenant from which to retrieve it.

General variables

At the beginning of the script fsw_vars.yml, there is a series of variables that need to be configured with the system credentials and any filters you want to apply to the tracking of outgoing calls.

First we set credentials and logins:

uniloader_version: "25.01.1"

# The ESL port on Freeswitch
fsw_host: "127.0.0.1"
fsw_port: "8021"
fsw_auth: "ClueCon"

# Credentials to connect to Postgres DB used by Fusion
fusion_db: "127.0.0.1/fusionpbx?sslmode=disable"
fusion_login: "fusionpbx"
fusion_pwd: "SomePassword"

Then we customize the general environment:

# Filters for outbound tracking
outbound_include_caller: ""
outbound_exclude_caller: ""
outbound_include_callee: "^9.+"
outbound_exclude_callee: ""

# AudioVault
# You have to escape all "%" characters to "%%"
audiovault: True
av_port: "localhost:4040"
av_public_url: "https://tenant1.server.com/audiovault"
av_path: "file:/var/lib/freeswitch/recordings/%%TE/archive/%%YY/%%ME/%%DD"
av_token: "CHANGEME"

# Autoconfiguration
# You need to have user "robot" enabled in QmLive
# To always force autoconfiguration, we just remove the contents of autoconfigdir
autoconfiguration: True
autoconfigure_always: False
autoconfigure_agent_pwd: "v3rys3cret"
default_domain: "mydomain.com"

In the example above:

  • We install Uniloader 25.01.1

  • We use the default ESL credentials

  • We only include manual outbound tracking only for calls starting with the digit 9 - the filter is a regular expression that you can tailor to match your dialplan.

  • We install AudioVault

  • When agents are configured in QueueMetrics, they can log to their agent page with login agent/123 (where 123 is their agent code) and the password v3rys3cret

  • All FusionPBX tenants share the domain mydomain.com (see below)

Describing all tenants

In the file fsw_clients.yml, for each tenant that you want to activate, you should configure its credentials. For each tenant in FusionPBX, enter their name and their attributes.

The name of the tenant is their domain name minus the default_domain part as defined above. For example, if your tenant is called tenant1.mydomain.com and the default domain is set to mydomain.com, then the tenant name is tenant1.
tenant1:
	url:   "http://my.queuemetrics-live.com/tenant1/"
	login: "webqloader"
	pass:  "APassword"
	actions: True
	disabled: False
	av_secret: "ASecretForAudiovault"
	refresh: ""

That’s all you have to do. The script checks whether the instance is correctly configured, is working and able to receive data.

You don’t have to define any tenants you don’t want to activate. If you do, e.g. because someone wanted a trial and then changed their mind and you don’t want to remove them in case they change their mind again, you can set them to disabled: True and they will be ignored.

Applying changes

It is also necessary to modify the ansible-hosts file to tell the script which server to connect to (or configure the local server). The script uses Ansible, which must be installed on the machine from which it is launched.

Once configured, simply run the command ./run.sh.

If changes are made to the script, for example, by adding a new tenant or modifying a configuration, the script itself will take care of applying them.

Where should the integration be installed?

In simpler cases, if the system is not very large, it is possible to install the integration directly on the same PBX. In this case, access to the PBX and its database is very easy as they are already set up for local access from the same machine, and audio recordings are already in the correct folder.

For example, on a Debian 12 server you would do this:

  • Install Git and Ansible: apt-get update && apt-get install git ansible

  • Find a suitable working folder, e.g. /root

  • Clone the repo: git clone https://github.com/Loway/OpenQueueMetricsAddOns.git

  • Go to our Ansible script: cd OpenQueueMetricsAddOns/ansible-fusionpbx

  • Edit 'ansible-hosts' to enable the local connection: make sure the only uncommented entry is localhost ansible_connection=local

  • Edit variables and instances

  • Run everything with ./run.sh

Next time you have to add/remove/change something, you just edit variables and/or instances and launch the script again.

If the PBX system is very busy, it is possible to install the services on a separate machine in the same data center. The advantage is that any operations will not affect the PBX; the disadvantage is that it is necessary to ensure that the ESL, the PostgreSQL database, and any folders containing audio recordings are made accessible from this new server.

Planning your moves

The procedure below expect you to be able to create instances in QueueMetrics Live directly, as an Operator. If you are not an Operator, just ask Loway for instances to be created or deleted.

First run

  • Decide on one or more tenants on the PBX for which you want to activate the QueueMetrics services.

  • Enter the configuration page in FusionPBX and configure/create all the queues and all the agents that will be used. Note down how many agents you create - this will be the size of your instance. See details in Configuring FusionPBX.

  • Create them in the QueueMetrics Operator Panel interface and note their addresses and passwords. Wait a few minutes so you can see them working.

  • Enter the general connection and configuration information for the PBX in the first part of the script.

  • Enter the configurations for each tenant (addresses and passwords).

  • Run the script and wait for it to complete. Agents and queues as set in FusionPBX will be pre-configured in your QM instances.

  • If you want to run AudioVault, set up an HTTPS proxy for it - see e.g. AudioVault under HTTPS - and set its secret in QueueMetrics.

Importing Configuration Changes

If you need new agents or new queues, you must first create them on the tenant. If they are created only in QueueMetrics, they cannot function correctly.

  • If you create new agents, you will have to increase the number of licensed agents for their instance in the Operator Portal

  • Edit the script to reflect the new configuration (if needed) and in any case set a new value in the tenant’s "refresh" field

  • Run the script again.

In a few seconds, all the settings will be recreated, and the information relating to the new agents and queues created will be associated with the corresponding tenant.

Activating a new tenant

  • Create the new instance in the Operator’s portal and wait for it to be active

  • Add your new tenant to the configuration script

  • Run the script again.

Deleting a tenant

  • Remove the tenant from the script.

  • Turn off the tenant’s QueueMetrics instance from your Operator Panel.

  • Run the script again.

Default users

When you create a new instance, you will have to enter a new password. We call that the default password and is set for all users created automatically.

We suggest that you keep it for users as their "first login" but tell them to change it immediately afterwards.

Pre-defined QueueMetrics user of interest:

  • demoadmin (password default): an all-powerful administrator

  • webqloader (password default): the user that receives new queue-log data. Not meant for interactive login.

  • robot (password default): the user that creates and edits system configuration.

  • agent/xxx where xxx is the Agent-ID in FusionPBX: an agent - the password will be the one specified in Ansible as autoconfigure_agent_pwd.