Change the number / context for calling to asterisk

Contact us instead of reading the instructions

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:

Initializing a call from CRM may not work for the following reasons:

  • A phone number in CRM starts with a +;

  • Asterisk is configured with special dialing, for example, you can call only after 9.

The logic of this refinement will be as follows: we will receive the last 10 characters (for Russia) and add the desired prefix to the result. In the example, the prefix will be the number 8.

To configure customization, you must include the customizer file in the module settings. Editing the file /opt/bx24asterisk/custom/process_originate_params.php.

If there is no / opt / bx24asterisk / custom folder, edit the file /opt/bx24asterisk/customizer.php, after the line case 'process_originate_params'.

//имена параметров как в конфиге
$phone = &$params['extension'];
//Получаем в $match последние 10 цифр номера
if(preg_match('~(\d{10})$~', $phone, $match)){
//Добавляем к найденому префикс
$phone = '8' . $match[1];
}
return array(
'state' => 'success',
'data' => $params
);

There is a need to call through different contexts. In the example: calls from numbers (161, 162, 163) will go through the context custom-context-1; from numbers (141, 140) through the context custom-context-2; other calls will go through the standard context specified in the settings.

//имена параметров как в конфиге
$phone = &$params['extension'];
$channel = explode('/', $params['channel']);
$contexts = array(
'custom-context-1' => array(161, 162, 163),
'custom-context-2' => array(141, 140),
);
foreach($contexts as $context => $phones){
if(in_array($channel[1], $phones)){
$params['context'] = $context;
break;
}
}
return array(
'state' => 'success',
'data' => $params
);