Voice Recording Components Deployment Guide

Prerequisites

Software Requirements

Item

Recommended

Installation guide

Operating System

Debian 12

-

Docker

v24 or higher

-

MongoDB

Latest version

Installation

EF CX

Latest version

Deployment

Secondary FQDN for EFCX

-

IT/Customer will provide a separate FQDN routed to the Media Server IP on Middleware Port

Media Server

Latest version

Media Server Installation

Media Server Configuration

Port Utilization Requirements

The following ports must be open on the server for the program to function.

Type

Application

Description

Port

TCP

MongoDB

Database access port

27017

TCP

Postgres

Database access port

5432

TCP

Postgres

Database access port

6115

The ports can be opened as follows:

  • SSH into the Media Server.

    • Use command:

      ssh username@server-ip
      
    • Enter the ssh password and press Enter.

  • Use command:

    su
    
  • Enter the root user's password

  • Run the following commands:

    for port in 5432 27017 6115; do sudo iptables -C INPUT -p tcp --dport $port -j ACCEPT 2>/dev/null && echo "✅ Port $port already open" || (sudo iptables -A INPUT -p tcp --dport $port -j ACCEPT && echo "✅ Opened TCP port $port"); done
    sudo iptables-save
    

Media Server PostgreSQL Configuration

  • Navigate to the Postgresql folder.

    • cd /etc/postgresql/<version>/main/
      
    • Where <version> is the version of Postgresql being used.

  • Open the file postgresql.conf.

    • vi postgresql.conf
      
    • Scroll down to find the line #listen_addresses='*' and remove the # symbol.

  • Save and exit by :

    • Press the Esc key.

    • Enter the phrase :wq to save and exit.

  • Open the file pg_hba.conf.

    • vi pg_hba.conf
      
  • Scroll down to the bottom and add the line:

    • host    all             all             0.0.0.0/0            md5
      
  • Save and exit by :

    • Press the Esc key.

    • Enter the phrase :wq to save and exit.

  • Restart the Postgresql service:

    • systemctl restart postgresql
      

Create MongoDB database

  1. Run command to enable mongodb:

    systemctl enable mongod
    
  2. Go to root:

    cd ~
    
  3. Open the MongoDB config file:

    vi /etc/mongod.conf
    
  4. Locate the field bindIp and set its value to the IP address of the current server. find the #network interfaces line as example given below

    # network interfaces
    net:
      port: 27017
      bindIp: <Your server IP>
    
  5. Note the value of the port field as well.

  6. Run command:

    systemctl restart mongod
    
  7. Run command:

    mongosh --host HOST --port PORT
    
    1. Where HOST is the value of the bindIp field in Step 4.

    2. PORT is the value of the port field noted in Step 5.

  8. In the following text replace USER and PASS with your choice of username and password respectively, then copy and paste it in the Mongo CLI opened in the previous step, and press enter:

    use recording-link-activities
    
    db.createUser({
      user: "User",
      pwd: "Password",   // use a strong password
      roles: [
        { role: "readWrite", db: "recording-link-activities" }
      ]
    })
    
  9. Confirm the user creation with this command. after creating the user with step 8 above. run this command

    db.getUsers()
    
  10. Exit with the command:

    exit
    

Container Deployment

  • Run the command:

    docker login gitimages.expertflow.com
    
    • For the username prompt, enter efcx and for the password prompt enter RecRpsuH34yqp56YRFUb.

  • Create a folder recording-link-uploader with the command:

    mkdir recording-link-uploader
    
  • Enter the folder with the command:

    cd recording-link-uploader
    
  • Create a file docker-compose.yml.

    vi docker-compose.yml
    
  • Enter editing mode with the 'I' or 'Insert' keys.

  • Copy the contents below and paste them into the file docker-compose.yml

    version: "3.8"
    services:
      recording-link-uploader:
        image: gitimages.expertflow.com/voice-recording-solution/recording-link-activities:TAG
        deploy:
          resources:
            limits:
              memory: 1024m
            reservations:
              memory: 256m
        container_name: recording-link-uploader
        env_file:
          - ./env.txt
        volumes:
          - /var/lib/freeswitch/recordings/:/var/lib/freeswitch/recordings/
        command: ["java", "-Xms256m", "-Xmx1024m", "-XX:+UseG1GC", "-XX:MinHeapFreeRatio=10", "-XX:MaxHeapFreeRatio=30", "-jar", "/app/recording-link-activities.jar"]
        restart: no
    
    • Where TAG is the image tag required. Click here to see tags compatibility.

  • Save and exit by :

    • Press the Esc key.

    • Enter the phrase :wq to save and exit.

  • Create a file env.txt

    vi env.txt
    
  • Enter editing mode with the 'I' or 'Insert' keys.

  • Copy the contents below and paste them into the file env.txt

If you want to deploy with EFSWITCH Profile then paste from EF-Switch Profile. If you want to deploy the link uploader for CISCO profile then paste from Cisco Profile

EF-Switch Profile:
RECORDING_BACKEND=EFSWITCH
CX_FQDN=https://<EFCX>.expertflow.com
CX_ROOT_DOMAIN=expertflow.com
CX_TENANT_URL=https://<EFCX>.expertflow.com/cx-tenant
   
LOG_LEVEL=DEBUG
MIDDLEWARE_API=http://192.168.1.17:6115

RETRIEVAL_INTERVAL=1

MONGODB_HOST=192.168.1.17:27017
MONGODB_PASSWORD=12345
MONGODB_USERNAME=zeeshan
MONGODB_AUTHENTICATION_DATABASE=recording-link-activities
MONGODB_REPLICASET=none
MONGODB_READ_PREFERENCE=secondaryPreferred
MONGODB_ENABLE_SSL=false
MONGODB_REPLICASET_ENABLED=false
TRUST_STORE_PASSWORD=none
KEY_STORE_PASSWORD=none

DB_IP=192.168.1.17
DB_NAME=fusionpbx
DB_PASS=Expertflow464
DB_PORT=5432
DB_USERNAME=fusionpbx

AUTH_ENABLED=false
API_USERNAME=voice_auth
API_PASS=pass
CLIENT_ID=cim
CLIENT_SECRET=secret

Link Uploader with Cisco profile is single tenant supported only. Also middleware part and below is not required for Cisco Profile except Create CRON Job.

Cisco Profile:
RECORDING_BACKEND=CISCO

VRS_DB_IP=192.168.1.126
VRS_DB_PORT=1433
VRS_DB_NAME=vrs200
VRS_DB_USERNAME=sa
VRS_DB_PASS=Expertflow123
VRS_QUERY_BATCH_SIZE=500

CX_FQDN=https://vrsdb.expertflow.com

MIDDLEWARE_API=https://<VRS MACHINE IP>/vrs/middleware/recording

AUTH_ENABLED=true
API_USERNAME=admin
API_PASS=admin

MONGODB_HOST=<MONGO IP>:<MONOGO PORT>
MONGODB_PASSWORD=<MONGO PASSWORD>
MONGODB_USERNAME=<MONGO USERNAME>
MONGODB_AUTHENTICATION_DATABASE=recording-link-activities
MONGODB_REPLICASET=none
MONGODB_READ_PREFERENCE=secondaryPreferred
MONGODB_ENABLE_SSL=false
MONGODB_REPLICASET_ENABLED=false

RETRIEVAL_INTERVAL=15
LOG_LEVEL=DEBUG

Environment Variables Details

Variable

Description

Default / Example / Notes

RECORDING_BACKEND

Recording backend/profile to use.

EFSWITCH or CISCO.

LOG_LEVEL

The amount of detail in the logs.

Default is INFO; for more detailed logs use DEBUG.

CX_FQDN

Complete CX FQDN.

Example: https://ef-cx.expertflow.com. Optional for MTT (recommended as fallback). Required for Cisco and on-prem single-tenant setups.

MIDDLEWARE_API

The Secondary EFCX FQDN.

Example: https://FQDN. Register a separate sub-domain in the root domain that points to the port exposed by the middleware container, 6115 default, example: https://middleware.expertflow.com. Secondary FQDN should be routed to media server IP on middleware port with http method (e.g. 6115). The same URL will be used by all tenants as a middleware endpoint for recording, playback, and download.

MONGODB_HOST

IP address and port of the Mongo Database.


MONGODB_PASSWORD

Password of the Mongo Database.


MONGODB_USERNAME

Username of the Mongo Database.


MONGODB_AUTHENTICATION_DATABASE

MongoDB authentication database.

Keep at the default value recording-link-activities.

MONGODB_READ_PREFERENCE

MongoDB read preference.

Keep at default secondaryPreferred.

MONGODB_ENABLE_SSL

Whether MongoDB SSL is enabled.

Keep at default false.

MONGODB_REPLICASET_ENABLED

Whether MongoDB replicaset is enabled.

Keep at default false.

MONGODB_REPLICASET

MongoDB replicaset value.

Keep at the default none.

TRUST_STORE_PASSWORD

Trust store password.

Keep at the default of none.

KEY_STORE_PASSWORD

Key store password.

Keep at the default of none.

RETRIEVAL_INTERVAL

The number of past days to push recording links for on startup.


DB_NAME

Media Server database name.

Keep at default fusionpbx.

DB_URL

Media Server server IP address.


DB_PORT

Media Server database port.

Keep at the default 5432.

DB_USERNAME

Media Server database name.

Default is fusionpbx unless changed manually in Media Server.

DB_PASS

You can get the DB_PASS using the command below:

cat /etc/fusionpbx/config.conf


AUTH_ENABLED

Whether APISIX authentication is enabled in EFCX.

true or false. The following settings below are set if this value is true.

API_USERNAME

The username created in Keycloak for API authentication.

  • On Keycloak, create a user in the Expertflow realm.

  • Assign the admin and default roles to it.

  • Assign a non-temporary password to this user as well.

Required when AUTH_ENABLED is true.

API_PASS

The password for the above user created in Keycloak for API authentication.

Required when AUTH_ENABLED is true.

CX_ROOT_DOMAIN

CX root domain configuration.

For MTT → expertflow.com.
For on-prem → set to the tenant name (e.g. expertflow, vrsdb) so the app uses CX_FQDN directly.

CX_TENANT_URL

CX tenant URL to fetch tenants.

Example: https://mtt02.expertflow.com/cx-tenant. We can use any of the tenant subdomains in place of tenant4, which is configured in CX.

VRS_DB_IP

IP of VRS MIXED_SESSIONS DB.


VRS_DB_PORT

Port of VRS MIXED_SESSIONS DB.


VRS_DB_NAME

Name of VRS MIXED_SESSIONS DB.


VRS_DB_USERNAME

DB username.


VRS_DB_PASS

DB password.


VRS_QUERY_BATCH_SIZE

VRS query batch size.

Will be 500 and should not be greater than 1500.

Within the folder, run the command:

docker compose up --no-start

Confirm that the docker container is created:

docker ps -a

Middleware

  • Create a folder recording-middleware with the command at root:

    mkdir recording-middleware
    
  • Enter the folder with the command:

    cd recording-middleware
    
  • Create a file docker-compose.yml.

    vi docker-compose.yml
    
  • Enter editing mode with the 'I' or 'Insert' keys.

  • Copy the contents below and paste them into the file docker-compose.yml

    services:
      recording-middleware:
        image: gitimages.expertflow.com/voice-recording-solution/recording-middleware:TAG
        container_name: recording-middleware
        restart: always
        deploy:
          resources:
            limits:
              memory: 1024m
            reservations:
              memory: 256m
        ports:
          - 6115:8080
        env_file:
          - ./env.txt
        volumes:
          - /var/lib/freeswitch/recordings/:/var/lib/freeswitch/recordings/
          - ./decryptionCache:/app/files/wav/decryptionCache
        command: 
          - java
          - -Xms256m
          - -Xmx1024m
          - -XX:+UseG1GC
          - -XX:MinHeapFreeRatio=10
          - -XX:MaxHeapFreeRatio=30
          - -jar
          - /app/recording-middleware.jar
    
    • Where TAG is the image tag required. Click here to see tags compatibility.

  • Save and exit by :

    • Press the Esc key.

    • Enter the phrase :wq to save and exit.

  • Create a file env.txt

    vi env.txt 
    
  • Enter editing mode with the 'I' or 'Insert' keys.

  • Copy the contents below and paste them into the file env.txt

    LOG_LEVEL=DEBUG
    RECORDING_BACKEND=EFSWITCH
    ENCRYPTION_ENABLED=false
    DB_IP=192.168.1.10
    DB_PORT=5432
    DB_NAME=fusionpbx
    DB_USERNAME=fusionpbx
    DB_PASS=password
    
    • RECORDING_BACKEND: The mechanism for recording files. Keep it at EFSWITCH.

    • LOG_LEVEL: The amount of detail in the logs. Default is INFO, and for more detailed logs the value should be DEBUG.

    • ENCRYPTION_ENABLED: Whether encryption of recording files is enabled on the Media Server.

    • DB_IP: IP of Media Server

    • DB_NAME: Media Server database name. Keep at default fusionpbx.

    • DB_PORT: Media Server database port. Keep at default 5432

    • DB_USERNAME: Media Server database name. Default is fusionpbx unless changed manually in Media Server.

    • DB_PASS: You can get using this below command.

    • cat /etc/fusionpbx/config.conf
      
  • Within the folder run the command:

    docker compose up -d
    
  • Confirm that the docker container is running by using the command:

    docker ps
    

Add Indexing in Media Server Database

  • While on the Media Server, run the following command and note the output password:

    cat /etc/fusionpbx/config.conf | grep database.0.password
    
  • Run the following command and enter the password noted before:

    psql -h 127.0.0.1 -p 5432 -U fusionpbx -d fusionpbx
    
  • Run the following command:

    CREATE INDEX idx_mykey ON v_xml_cdr USING GIN (json) WHERE json->'variables' ? 'sip_h_X-CALL-ID';
    
    • Note: If the number of calls on the system is too high, then the query will take a long time to execute.

Create CRON Job

  • SSH into the Media Server.

    • Use command:

      ssh username@server-ip
      
    • Enter the ssh password and press Enter.

  • Use command:

    su
    
  • Enter the root user's password.

  • Navigate to recording-link-uploader folder.

  • Run the following command:

    echo '*/5 * * * * docker restart recording-link-uploader' > recording-link-uploader.cron
    
    • The 5 can be replaced with any other value to change the interval in minutes between each run of the uploader.

  • Run the following command to load the job into the cron scheduler:

    crontab recording-link-uploader.cron
    

Set Ingress and Service in EF CX

  • SSH into the EF CX server.

    • Use command:

      ssh username@server-ip
      
    • Enter the ssh password and press Enter.

  • Use command:

    su
    
  • Enter the root user's password.

  • Navigate to the root folder.

  • Create a file named ef-recording-middleware-efswitch.yaml and add the following content:

    apiVersion: v1
    kind: Service
    metadata:
      name: efswitch-service
    spec:
      ports:
      - name: https
        port: 6115
        targetPort: 6115
    ---
    apiVersion: discovery.k8s.io/v1
    kind: EndpointSlice
    metadata:
      name: efswitch-service-1
      labels:
        kubernetes.io/service-name: efswitch-service
    addressType: IPv4
    ports:
      - name: ''
        appProtocol: http
        protocol: TCP
        port: 6115
    endpoints:
      - addresses:
          - "<EFSWITCH-SERVER-IP>"
    ---
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: efswitch-service
      annotations:
        spec.ingressClassName: "nginx"
    #    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
    spec:
      rules:
      - host: <SECONDARY-FQDN>
        http:
          paths:
          - pathType: Prefix
            path: "/"
            backend:
              service:
                name: efswitch-service
                port:
                  number: 6115
    
    • Where EFSWITCH-SERVER-IP is the IP address of the Media Server.

    • Where SECONDARY-FQDN is the secondary fully qualified domain name for the running EFCX deployment. (for MTT, it is the separate sub-domain pointing to the middleware port)

  • Run the following command:

kubectl apply -f /root/ef-recording-middleware-efswitch.yaml