Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
analytics.php
1<?php
2
4
6use Bitrix\Im;
8
10{
11 public static function onCallCreate(Main\Event $moduleEvent): void
12 {
13 Main\Application::getInstance()->addBackgroundJob([self::class, 'sendAnalyticsCallStarted'], [$moduleEvent]);
14 }
15
16 public static function sendAnalyticsCallStarted(Main\Event $moduleEvent): void
17 {
18 if (!Main\Loader::includeModule('im'))
19 {
20 return;
21 }
22
23 $chatId = (int)($moduleEvent->getParameters()['chatId'] ?? null);
24 if ($chatId <= 0)
25 {
26 return;
27 }
28
29 $conferenceId = Im\V2\Chat::getInstance($chatId)->getAliasName();
30 if (!is_string($conferenceId))
31 {
32 return;
33 }
34
35 $parentLink = (new Sharing\Link\Factory())->getParentLinkByConferenceId($conferenceId);
36 if (is_null($parentLink))
37 {
38 return;
39 }
40
41 Sharing\Analytics::getInstance()->sendCallStarted($parentLink);
42 }
43}
static sendAnalyticsCallStarted(Main\Event $moduleEvent)
Definition analytics.php:16
static onCallCreate(Main\Event $moduleEvent)
Definition analytics.php:11
static includeModule($moduleName)
Definition loader.php:69