Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function GetCurrentCallData($dst)
- {
- $response = _AsteriskAjam::CoreShowChannels();
- foreach ($response as $entry) {
- if (
- empty($entry['BridgedChannel'])
- || stripos($entry['Channel'], "SIP/{$dst}") === false
- ) {
- continue;
- }
- $is_outgoing = false;
- // Нам нужны только члены очередей
- if (
- (
- $entry['Event'] == 'CoreShowChannel'
- && $entry['ChannelStateDesc'] == 'Up'
- && $entry['ApplicationData'] == '(Outgoing Line)'
- ) || $is_outgoing = _AsteriskAjam::GetVar($entry['BridgedChannel'], 'call_type') == self::CALL_TYPE_OUTGOING
- ) {
- // Оригинальный идентификатор звонка
- $call_id = _AsteriskAjam::GetVar($entry['BridgedChannel'], 'UniqueID_Orig');
- if ($call_id) {
- $entry['BridgedUniqueID'] = $call_id;
- }
- // Идентификатор ROIstat
- $entry['RoiStatId'] = _AsteriskAjam::GetVar($entry['BridgedChannel'], 'X-ROISTAT-ID') ?: '';
- if (!$is_outgoing) {
- // Подменяем номер телефона, оригинальный хранится в переменной
- $entry['ConnectedLineNum'] = substr(
- _AsteriskAjam::GetVar($entry['BridgedChannel'], 'INCOMINGCALLERID'),
- -10
- );
- } else {
- // получаем телефон клиента
- $phone = $entry['Extension'];
- if (starts_with($phone, '8')) {
- $phone = substr_replace($phone, '', 0, 1);
- }
- $entry['ConnectedLineNum'] = $phone;
- }
- // Данные для формирования order_pbx_calls
- $entry['PbxCall'] = static::prepareOrderPbxCall($entry);
- // Ответ готов, отдаем запись о канале целиком
- return $entry;
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement