Change phone number before sending data to CRM

If you don't want to go into details, contact us. We will quickly help you and answer all questions! Contact us in any convenient way.

If necessary, you can change the phone number received from the PBX before sending data to CRM.

This will be useful if you want:

This will be useful if you want to:

  • Automatically add the area code to short numbers dialed by employees;

  • Replace 7 with 8 at the beginning of the number, if incoming calls are recorded from 7;

  • Add 8 at the beginning of the number, if incoming calls come without 8...

Editing the file /opt/itgrix_bx/customizer/actions/process_phone_number.php.

Example of trimming a number and substituting 8 at the beginning

In the following example, for all numbers of 10 characters or more, CRM will get a number at the beginning of which will be 8, and at the end - the last 10 digits of the original phone number:

  • 4991234567 will be replaced with 84991234567

  • 1234567 will be unchanged

  • 39974991234567 will be replaced with 84991234567

  • 74991234567 will be replaced with 84991234567

  • +74991234567 will be replaced with 84991234567

$phone = $params['phone'];

// Getting the last 10 digits of the number
if(preg_match('/([0-9]{10})$/', $phone, $match)){
// if the number has 10 digits at the end, then add an eight to the beginning
    $phone = '8' . $match[1];
}

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

Last updated