# Genesys Quality Management Suite 8.1.520 : Additional Call Recording Scripts

Created and last modified by

Routine tasks like backup are performed with Call Recording tools, located on the Maintenance tab in Settings.
Specialized and occasional tasks in Call Recording are performed with Call Recording scripts, executed directly from the command line.
All Call Recording scripts are located in:

    /opt/callrec/bin

Call Recording scripts are executed like any other shell script. Most scripts also require additional parameters.

## bugreport

Use the `bugreport` script to report bugs or request assistance from Genesys Tech Support.

The `bugreport` script collects all relevant system information, including logs, configuration, error messages, and server status. If no parameter is given to the script the output ZIP files is stored to the folder `/opt/callrec/data/` and it's size depends on the size of the log files. 8MB on a clean installed system.

To automatically send the results of the bugreport script to Genesys Tech Support, Enable SMTP within Call Recording so it can send email outside the local network.

The `bugreport` script has the following additional parameters (none of them are required):

    -h | --help                 - help
    -v | --verbose              - enable extra verbosity
    -d | --output-directory     - target directory; contents will be packed
    -c | --no-checksums         - disable creation of checksums
    -r | --no-rpm-verify        - disable RPM verification
    -o | --no-oscheck           - disable OS check
    -n | --no-dbschemas         - disable creation of DB schemas
    -l | --no-compressed-logs   - do not collect compressed logs
    -z | --zoom-only            - do not collect system logs and info
    -s | --system-only          - do not collect ZOOM logs and info
    -g | --no-cfg2html          - do not collect system info using CFG2HTML
    -f | --cfiles-consistency   - check for differences between cfiles table and filesystem
    -C | --cmdb-only            - create a light version with no logs and no DB dumps
    -D | --remote-db            - retrieve data from remote DB instead of local DB
                                  the syntax of this parameter is "dbtype:host:port:dbname:dbuser:dbpassword"
                                  currently only PSQL is supported, example: -D P:192.168.110.150:5432:callrec:postgres:callrec

The `bugreport` script requires administrator (`root`) privileges to run. Run it using one of the following methods:

1. Log in to the server console or start an SSH session as the `root` user OR log in using a non-administrator user account (for example `admin`) and switch to an account with higher privileges using the `su` utility: `su - root`

2. Run the following command, including any appropriate parameters as required:

       /opt/callrec/bin/bugreport

   RedHat Linux also includes the sudo command, enabling a normal user to run a command with administrative permissions, if the user is included in the `/etc/sudoers` file: `sudo -i /opt/callrec/bin/bugreport`

   Typical output from the command is as follows:

       [root@tstcr003 bin]# /opt/callrec/bin/bugreport
       Retrieving information from this machine: ........................ [ OK ]
       Zipping into archive: . [ OK ]
       Copying results to "./Call Recording_report_1235398690.zip" : [ OK ]

## call2mp3

The `call2mp3` script enables “raw” streamed data to be converted into audio files.

Use this script in the event an error occurs during encoding. Some streams may have remained un-encoded. The call2mp3 script enables these un-encoded streams to be selected and encoded as MP3 or WAV files.

The call2mp3 script does NOT add files to the database.

    /opt/callrec/bin/call2mp3 FILE1 [FILE2] [OPTIONS]

You can identify multiple file for encoding; FILE1 is the source file or directory, and additional files are identified within square brackets [FILE2] and so on. If you identify an entire directory, all the files within that directory will be processed.

If no additional parameters are set, the default values are used.

Parameters:

- `-e`: Allows you to select the encoding used for output – MP3 or WAV (the default setting is MP3)
- `-d`: Specifies a destination file or directory for the encoded files. This allows you to rename the output file if only one call is encoded.
- `-p`: Plays the encoded file immediately after encoding
- `-b`: Allows you to define the output file’s bitrate (for MP3 only -- see chapter See Audio Quality settings in Decoders for more information)
- `-logger`: Enables logging of encoding, this option must specify the path to the log4j properties file.
- `-help`: Displays help text.

## callrec_status

The `callrec_status` script displays information about a Call Recording component’s status, configuration, and availability. If you identify a Call Recording service with a single parameter, only that parameter’s status displays.

Use `callrec_status` to change some service parameters.

The `callrec_status` script uses the Application Communicator component.

    /opt/callrec/bin/callrec_status -PARAMETER(S)

Parameters:

- `-bindName [bindName]` – allows you to specify the RMI bind name of the selected Application Communicator –use the complete path (the default value is `//localhost:30400/remoteCall Recording` )
- `-help`: Displays help.
- `-host [host]`: Allows you to specify the RMI host of the selected Application Communicator (the default value is localhost).
- `-modifyHelp [{name}|all]`: Displays available help information about modifiable properties (for specific module or all modules).
- `-modifyInt [module,property,value]`: Allows you to modify a property of the selected module if the property type is an Integer. Use the formatModuleName, PropertyName, NewValue, (possible values and names can seen with modifyHelp).
- `-modifyNames`: Returns names of modules allowing modification of properties.
- `-modifyString [module,property,value]` : Allows you to modify properties of a selected module if the property type is String Use the formatModuleName, PropertyName, NewValue (possible values and names can be seen with modifyHelp).
- `-name [name]`: Allows you to specify the RMI bind name for the selected Application Communicator (the default value is remoteCallRec).
- `-names`: Returns all available names for the Application Communicator interface.
- `-port[port]`: Allows you to specify the RMI bind port for the specified Application Communicator (the default value is 30400).
- `-restart` : Remotely restarts the Application Communicator.
- `-state [{name}|all]`: Returns state information about selected module or all modules (the –state all output is identical to service callrec status)
- `-stateNames`: Displays the names of all modules providing state information.
- `-stateOption [status|failed]`: Allows you to limit displayed information to status (OK and FAILED) lines (status ) or to limit display to only the lines where the status is FAILED (failed).
- `-states`: Displays status of all modules providing state information (this is an extended version of –state all).
- `-stop`: Remotely stops the Application Communicator .
- `-verbosity [1|2|3|4|5]`: Sets the verbosity of state displays (all information: 5, default: 2, only state: 1)
- `-version [{name}|all]`: Displays version information for a named module, or all modules.
- `-versionNames`: Returns names of modules providing version information.

Sample usage:

    /opt/callrec/bin/callrec_status -state all -name <module name> -verbosity 5

You can obtain the list of modules by running:

    /opt/callrec/bin/callrec_status -states

Please note that module names are case sensitive.

## repaircalls

The `repaircalls` script is designed to help you recover from a decoder server dropout or other malfunction in the encoding process.

During normal operations, if there is an error preventing encoding of call data (for example, an unknown codec is used), the recorded streams are packed as zip files, and then stored for future recovery. In the event of decoder server failure during encoding, the raw data stays uncompressed in raw form.

The `repaircalls` script tries to recover all available un-encoded calls by moving them back into the decoding queue for processing by the decoder server. In other words, this tool repairs calls and makes them available for Call Recording users.

The `repaircalls` script searches all calls that can be recovered and encodes them into MP3 (or another selected format). You can specify a call’s couple ID for processing one call, or a time interval and maximum number of calls for automatic recovery of all calls within the specified interval.

Connection strings for core RMI and decoder are compulsory parameters.

Example: Repairing calls from a specified period

    /opt/callrec/bin/repaircalls -config_core [path and port] -config_decoder [path and port] -hour [interval] -limit[max files] -PARAMETERS

Example: Repairing a specific call

    /opt/callrec/bin/repaircalls -config_core [path and port] -config_decoder [path and port] -coupleid [ID] -PARAMETERS

- Parameters:
  `-config_core [configuration service]–` compulsory option, has to point to Core – as: `//address:port/core`
- `-config_decoder [configuration service]` - compulsory option, has to point to decoder - `//address:port/decoders`
- `-type [result type]` – used for defining output format - MP3, WAV, ZIP (the default value is mp3)
- `-hour [interval]` – defines how many hours to look backwards for data, 0 means all data.
- `-coupleid [db call id]` - ID of call couples that will be decoded
- `-limit [max. files]` – sets how many calls to repair when more calls are found within the selected interval (default value is 100, 0 means all files). This option is compulsory – it takes a lot of server resources to repair calls and this option prevents overloading the server.
- `-zipfiles` – Allows you to include ZIP files containing raw data for repair. If you do not include ZIP files, they are ignored by the `repaircalls` script.
- `-noupdatedb` – when this option is used, no updates will be made to the database and source files will stay on the server – use this, if you want to test “repairability” of selected couples.
- `-logger [logger properties]` –defines the path to properties for Log4J, when you want to create a log file.

- `-help` – displays help

Sample usage:

    /opt/callrec/bin/repaircalls -hour 2000 -limit 2000

Where the Hour states the delay how many hours ago the queue is checked until.

Limit stands for maximum number of fixed calls If you want to fix all calls until now, use 0 as a value for both parameters. Note it takes significant time to fix all files if the queue is long and it can also affect performance of the system. It is recommended to use this command during off-peak hours.

## selectivebackup

Normal backup is controlled through the Call Recording interface. The `selectivebackup` script enables the specification of additional backup parameters, such as external data, by directly editing the `tools.xml` configuration file values.

    /etc/callrec/tools.xml

There are no command line parameters. The `selectivebackup` function outputs files to a ZIP archive.

Open the tools.xml configuration file and locate Specified Configuration for selectivebackup.

     <SpecifiedConfiguration name="selectivebackup">
     <Value name="enabled">false</Value>

- `enabled` can be set to true (enabled) or false (disabled).

      <Value name="exportFilename">calls.xml</Value>
       <Value name="basename">export</Value>
       <Value name="maxSize">30</Value>
       <Value name="crc">true</Value>

- `exportFilename` specifies the name of the XML file exported by `selectivebackup`.

No changes are required in this value. The exported xml file is stored in a different directory than that used by the standard backup tool.

`basename` is the filename of the backup zip archive and can be freely changed. The output filename will be `basename+timestamp+.zip`.

the `maxSize` value sets the maximum file size of the archive in MB. If the archive is bigger than this value, `selectiveback` up splits it into multiple files.

`crc` Create a checksum control. Set this to `true` or `false`.

     <Value name="xslFilename">calls.xsl</Value>
     <Value name="exportIndex">calls.html</Value>

`xslFilename` must end with the `.xsl` extention.
exportIndex must end with the `.htm` or `.html` extension

     <Value name="resourceDir">res</Value>

`resourceDir` specifies the subdirectory with resources related to the description files, such as pictures used by `exportIndex`. Do not change this value.

     <Value name="database">callrec</Value>

The `database` value identifies the source of call information to be backed up. This database is also used in any filtering. This must be the database used by Call Recording– typically this is the `callrec` pool. Use the Call Recording GUI to verify the name of this value.

     <Value name="time">start=1.1.1800 end=1.1.1900</Value>

`time` specifies times to start and end date the backup. All calls within this interval will be processed. The format of date and time values is the same as for all other tools.

     <Value name="filesOnly">true</Value>
     <Value name="deleteFiles">false</Value>

- `filesOnly` can be set to true or false. When the value is true, only files with calls or video are stored. When the value is false, then the related database records are also stored.
- `deleteFiles` allows you to enable (true) or disable (false) the deletion of database files once they have been backed up.

    <Value name="cfgDir">/opt/callrec/tools</Value>
    <Value name="tmpDir">/tmp/export/tmp</Value>
    <Value name="sourceDir">/home</Value>
    <Value name="targetDir">/tmp/export</Value>
    <Value name="intervalPeriod"/>
    <Value name="backupDir">{$USER}/</Value>

`cfgDir`: Identifies the directory where main tools files (java executables) are stored. Usually /opt/callrec/tools.

`tmpDir`: Identifies the temporary directory for backup.

`sourceDir`: Identifies the source directory where calls are stored.

`targetDir` : Identifies the target directory where the backup will be created.

`intervalPeriod`: Allows you to define the time period to run `selectivebackup`. You can define wake up and suspend times to prevent running regular backup simultaneously with `selectivebackup`.

`backupDir` : Identifies the directory to be created within the target directory where backups are stored. The variable {`$USER`} is set as the default – the directory has the name of the user who executes `selectivebackup`.

The values of directories used by `selectivebackup` should NOT ordinarily be changed.

     <Value name="wakeupTime">00:10</Value>
     <Value name="suspendTime">23:30</Value>

`wakeupTime` and `suspendTime` allows you to prevent running regular backup simultaneously with `selectivebackup`.

     <Value name="limitQuery">description = &apos;XYZ&apos;</Value>
     </SpecifiedConfiguration>

`limitQuery` – allows you to specify a search string that filters the back up. Identify any string within the call description, or standard Call Recording database entity.

You must use the format `&apos;string&apos`;

Example: To limit the backup to only the calls that contain the word “training” in the call description field:

     <Value name="limitQuery">description = apos;training&apos;</Value>

Do not use wildcards or multiple values. The limitQuery script finds only exact matches.

When the r `selectivebackup` values are defined, save the changes to the xml file.

To execute the `selectivebackup` script, use the command line. All parameters are defined in the configuration file.

    selectivebackup

## tools

The tools script initializes maintenance tools and executes them. The tools script is executed periodically by cron. The default period is every day at 0:00. To check the status of this script, check the crontab.

## gen_cfgtest

The gen_cfg_test script updates system configuration when the Genesys integration module is used. This script interconnects Call Recording and Genesys Configuration server.

## Additional Scripts

There are two additional scripts used during installation:

- `chkcalls` changes attributes of storage directories to grant read/write permission to Call Recording
- `mkcalls` is used for creating the directory structure

There is no need to execute these two scripts manually.