LogoLogo
  • What is Itgrix
  • Contacts
  • Our story
  • Connector installation
    • System requirements
    • Itgrix for Bitrix24 and Asterisk
      • How to perform offline authorization
      • How to obtain a license offline
      • Configuring the connector to work in a closed network
      • Call tests
    • Itgrix for Kommo and Asterisk
      • Restricted mode setting features
      • Call card
      • Call tests
  • Additional functions
    • Automatic call transfer to responsible manager
    • Setting up click-to-call features
      • Features of customization after Bitrix24 23.300.0 update
    • Autoreplacement for phone numbers
    • How to view employee call statistics in Bx24
    • FMC number recognition
    • Configuring WebRTC in Asterisk (FreePBX)
    • Itgrix AsterPhone for Bitrix24
    • Itgrix AsterPhone for Kommo
  • For admins
    • Running an additional copy of the module
    • Deploying a module backup
    • Call processing for the period
    • Examples of the structure of registered calls from CEL
    • Wrong time in created cases in Bitrix24
    • SSH access
    • Useful commands
    • Script to test the module service
    • Changing login and password to enter the admin panel
    • Module files
    • Status monitoring
    • Application update
    • In the CEL table, there is no internal employee number in the cid_num column
    • How to fix click-to-call
    • Custom SSL certificates for https requests
    • Examples of configuring WSS connections
    • Converting recordings to MP3 before sending to Bitrix24
    • How to fix call recording problems
    • Install and configure CEL
    • B24 authorization bugfix
  • Useful customizations (any CRM)
    • Audio file name customization
    • Call data (call_full) in customizations
    • Change the number / context for calling to asterisk
    • Change phone number before sending data to CRM
    • Black and white lists
  • Useful customizations itgrix_bx (Bitrix24)
  • Useful customizations itgrix_kmo (Kommo)
  • FAQ
    • How to pay
    • How to check licence status
    • Differences in connection to B24 via SIP-connector and Itgrix
    • How to turn off the display of calls in the calendar
    • How to view statistics on employee calls
    • Updating the app
    • Offline install (only for Bitrix24)
    • Offline update
    • Reliable softphones for Asterisk
    • Detail-call-statuses
  • Changelog Itgrix_bx
  • Changelog Itgrix_kommo
  • Policy of interaction with Asterisk
Powered by GitBook
On this page
  • Parameters
  • File before recording .wav
  • Complex file name for which data should be compiled from DBMS

Was this helpful?

  1. Useful customizations (any CRM)

Audio file name customization

The customization is configured in process_record_file_path.php, it is located in the directory:

itgrix_bx (Bitrix24)
itgrix_kmo (Kommo)

/opt/itgrix_bx/customizer/actions/

/opt/itgrix_kmo/customizer/actions

Parameters

Input:

{
  "call_id": “<Call ID>”,
  "from": “<Caller number>”,
  "to": “<The number to which the call came>”,
  "path": “<Path to record>”
}

Return:

{
  "data": {
    "path": “<Customized path to record>”
  },
  "state": "success"
}

The first step is to understand how the file name is generated. Sometimes it is necessary to substitute a folder with a specific date or other parameters into the file path.

File before recording .wav

In case all records are stored in one directory and their names look like .wav, the following solution of file selection customization without DBMS access is possible:

$callId = $params['call_id'];
$from = $params['from'];
$to = $params['to'];
$path = $params['path'];

extract(pathinfo($path));

$path = $dirname . '/' . $callID . '.wav';

return array(
    'state' => 'success',
    'data' => array(
        'path' => $path,
    ),
);

Complex file name for which data should be compiled from DBMS

Let's consider an example of customization for a format record: /var/spool/asterisk/monitor/<дата-время>-<from>-<to>-<Call ID>.<extension>

Example: /var/spool/asterisk/monitor/20180330140245-321654987-154-1522395542.2897.mp3

In this case we can see that the file name consists of digits - date/time of call, incoming number, internal number and uniqueid of call, which are specified with hyphens. Let's get the missing data from the database.

$callId = $params['call_id'];
$from   = $params['from'];
$to     = $params['to'];
$path   = $params['path'];

// If more parameters are needed to generate a file name,
// then they can be obtained in the database by making an additional query.
// Code example:
$dbResult = Utils::mysqliQuery(
    "SELECT * FROM `cdr` WHERE `uniqueid` = '".$callId."' ORDER BY `calldate` DESC LIMIT 1",
    true);

if ($dbResult === false) {
    return array(
        'state' => 'error',
        'data'  => 'Error during request in CDR',
    );
}
if (empty($dbResult)) {
    return array(
        'state' => 'error',
        'data'  => "There are no records found in the CDR for the call '$callId'",
    );
}

//Next, we compile the file name from the received data
$row = $dbResult[0];
$path = sprintf('/var/spool/asterisk/monitor/%s-%s-%s-%s.%s',
    date('YmdHis', strtotime($row['calldate'])),
    $row['src'],
    $row['dst'],
    $callId,
    pathinfo($row['recordingfile'], PATHINFO_EXTENSION)
);

return array(
    'state' => 'success',
    'data'  => array(
        'path' => $path,
    ),
);
PreviousUseful customizations (any CRM)NextCall data (call_full) in customizations

Last updated 28 days ago

Was this helpful?