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/bx24asterisk/custom/process_phone_number.php.
If there is no / opt / bx24asterisk / custom folder, edit the file /opt/bx24asterisk/customizer.php, after the line case 'process_phone_number'. (First you need to enable the customizer)

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
1
$phone = $params['phone'];
2
3
// Getting the last 10 digits of the number
4
if(preg_match('/([0-9]{10})$/', $phone, $match)){
5
// if the number has 10 digits at the end, then add an eight to the beginning
6
$phone = '8' . $match[1];
7
}
8
9
return array(
10
'state' => 'success',
11
'data' => array(
12
'phone' => $phone,
13
),
14
);
Copied!
Last modified 10mo ago