Skip to main content
Skip table of contents

CX 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 from the one used in EFCX

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:

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

  • Use command:

    CODE
    su
  • Enter the root user's password

  • Run the following commands:

    CODE
    sudo iptables -A INPUT -p tcp -m tcp --dport 5432 -j ACCEPT
    sudo iptables -A INPUT -p tcp -m tcp --dport 27017 -j ACCEPT
    sudo iptables -A INPUT -p tcp -m tcp --dport 6115 -j ACCEPT
    sudo iptables-save

Media Server PostgreSQL Configuration

  • SSH into the Media Server.

    • Use command:

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

  • Use command:

    CODE
    su
  • Enter the root user's password

  • Navigate to the Postgresql folder.

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

  • Open the file postgresql.conf.

    • CODE
      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.

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

    • CODE
      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:

    • CODE
      systemctl restart postgresql

Create MongoDB database

  1. SSH into the Media Server.

    • Use command:

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

  2. Use command:

    CODE
    su
  3. Enter the root user's password.

  4. Run command:

    CODE
    systemctl enable mongod
  5. Open the MongoDB config file:

    CODE
    vi /etc/mongod.conf
  6. Locate the field bindIp and set its value to the IP address of the current server.

  7. Note the value of the port field as well.

  8. Run command:

    CODE
    systemctl restart mongod
  9. Run command:

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

    2. PORT is the value of the port field in Step 4.

  10. 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:

    CODE
    use recording-link-activities
    db.createUser(
      {
        user: "USER",
        pwd: "PASS",
        roles: []
      }
    )
  11. Exit with the command:

    CODE
    exit

Container Deployment

  • SSH into the Media Server.

    • Use command:

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

  • Use command:

    CODE
    su
  • Enter the root user's password.

  • Run the command:

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

Link Uploader

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

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

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

    CODE
    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

    CODE
    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.

  • Save and exit by :

    • Press the Esc key.

    • Enter the phrase :wq to save and exit.

  • Create a file env.txt

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

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

    CODE
    CX_FQDN=https://ef-cx.expertflow.com
    CX_CONVERSATION_MANAGER=https://ef-cx.expertflow.com/conversation-manager     
    LOG_LEVEL=DEBUG
    MIDDLEWARE_API=https://ef-cx.expertflow.com
    RECORDING_BACKEND=EFSWITCH
    RETRIEVAL_INTERVAL=10
    MONGODB_HOST=192.168.1.10:27017
    MONGODB_PASSWORD=1234
    MONGODB_USERNAME=efcx
    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.10
    DB_NAME=fusionpbx
    DB_PASS=password
    DB_PORT=5432
    DB_USERNAME=fusionpbx
    AUTH_ENABLED=true
    API_USERNAME=voice_auth
    API_PASS=pass
    CLIENT_ID=cim
    CLIENT_SECRET=secret
    • RECORDING_BACKEND: Keep at default EFSWITCH.

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

    • CX_FQDN: The address of EF CX. https://FQDN

    • CX_CONVERSATION_MANAGER: EF CX Conversation Manager endpoint. https://FQDN/conversation-manager

    • MIDDLEWARE_API: The Secondary EFCX FQDN. https://FQDN

    • 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: Keep at default value recording-link-activities.

    • MONGODB_READ_PREFERENCE: Keep at default secondaryPreferred.

    • MONGODB_ENABLE_SSL: Keep at default false.

    • MONGODB_REPLICASET_ENABLED: Keep at default false.

    • MONGODB_REPLICASET: Keep at default none.

    • TRUST_STORE_PASSWORD: Keep at default none.

    • KEY_STORE_PASSWORD: Keep at default 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 default 5432

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

    • DB_PASS: Media Server database password.

    • AUTH_ENABLED: true or false depending on whether APISIX authentication is enabled in EFCX. The four 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, and have Email-Verified option enabled.

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

    • API_PASS: The password for the above user created in Keycloak for API authentication

    • CLIENT_ID: Should always be cim.

    • CLIENT_SECRET: Found on Keycloak in the cim client.

  • Within the folder run the command:

    CODE
    docker compose up --no-start
  • Confirm that the docker container is created:

    CODE
    docker ps -a

Middleware

  • Create a folder recording-middleware with the command:

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

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

    CODE
    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

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

  • Save and exit by :

    • Press the Esc key.

    • Enter the phrase :wq to save and exit.

  • Create a file env.txt

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

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

    CODE
    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: Media Server database password.

  • Within the folder run the command:

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

    CODE
    docker ps

Add Indexing in Media Server Database

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

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

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

    CODE
    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:

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

  • Use command:

    CODE
    su
  • Enter the root user's password.

  • Run the following command:

    CODE
    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:

    CODE
    crontab recording-link-uploader.cron

Set Ingress and Service in EF CX

  • SSH into the EF CX server.

    • Use command:

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

  • Use command:

    CODE
    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:

    CODE
    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.

  • Run the following command:

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

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.